Merge "BUG 652 leafref CCE & BUG 720 colons problem"
authorEd Warnicke <eaw@cisco.com>
Mon, 28 Apr 2014 12:21:21 +0000 (12:21 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 28 Apr 2014 12:21:21 +0000 (12:21 +0000)
193 files changed:
opendaylight/commons/opendaylight/pom.xml
opendaylight/config/config-persister-api/src/main/java/org/opendaylight/controller/config/persist/api/PropertiesProvider.java
opendaylight/config/config-persister-api/src/test/java/org/opendaylight/controller/config/persist/test/PropertiesProviderTest.java
opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/DepTestImplModuleFactory.java [new file with mode: 0644]
opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/IdentityTestModuleFactory.java [new file with mode: 0644]
opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleFactory.java [new file with mode: 0644]
opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/TestImplModuleFactory.java [new file with mode: 0644]
opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/00-netty.xml
opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/02-clustering.xml
opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/03-toaster-sample.xml
opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/04-netconf-connector.xml [new file with mode: 0644]
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDFlowMapping.xtend
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/TestFromSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestToSalConversionsUtils.java
opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-flow-types.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/node-errors.yang [new file with mode: 0644]
opendaylight/md-sal/model/model-flow-service/src/main/yang/packet-processing.yang
opendaylight/md-sal/model/model-flow-service/src/main/yang/sal-flow.yang
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractForwardedTransaction.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ConcurrentImplicitCreateTest.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/NoficationTest.java
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/RoutedServiceTest.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataBrokerImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/compat/BackwardsCompatibleTransaction.java
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/MutableDataTree.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/OperationWithModification.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ResolveDataChangeEventsTask.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/SchemaAwareApplyOperation.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/ModificationType.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/NodeModification.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/DOMStoreWriteTransaction.java
opendaylight/md-sal/sal-netconf-connector/pom.xml
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.xtend [deleted file]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceListener.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceTwoPhaseCommitTransaction.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.java [new file with mode: 0644]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.xtend [deleted file]
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfRemoteSchemaSourceProvider.java
opendaylight/md-sal/samples/l2switch/implementation/src/main/java/org/opendaylight/controller/sample/l2switch/md/flow/FlowWriterServiceImpl.java
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/NodeStatisticsHandler.java
opendaylight/md-sal/topology-lldp-discovery/pom.xml
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.java [new file with mode: 0644]
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.xtend [deleted file]
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.java [new file with mode: 0644]
opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.xtend [deleted file]
opendaylight/netconf/config-netconf-connector/pom.xml
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/exception/NetconfConfigHandlingException.java [new file with mode: 0644]
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/exception/NoTransactionFoundException.java [new file with mode: 0644]
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/exception/OperationNotPermittedException.java [new file with mode: 0644]
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/AttributeIfcSwitchStatement.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/AbstractAttributeReadingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/ArrayAttributeReadingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/AttributeConfigElement.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/AttributeReadingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/CompositeAttributeReadingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/ObjectNameAttributeReadingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/ObjectXmlReader.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/SimpleAttributeReadingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/SimpleIdentityRefAttributeReadingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/mapping/ArrayAttributeMappingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/mapping/CompositeAttributeMappingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/mapping/ObjectMapper.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/mapping/ObjectNameAttributeMappingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/mapping/SimpleAttributeMappingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/mapping/UnionCompositeAttributeMappingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/ArrayAttributeResolvingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/AttributeResolvingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/CompositeAttributeResolvingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/ObjectResolver.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/SimpleAttributeResolvingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/UnionCompositeAttributeResolvingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/AbstractAttributeWritingStrategy.java [new file with mode: 0644]
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/CompositeAttributeWritingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/ObjectXmlWriter.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/RuntimeBeanEntryWritingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/SimpleAttributeWritingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/SimpleBinaryAttributeWritingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/SimpleIdentityRefAttributeWritingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/Config.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/InstanceConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/InstanceConfigElementResolved.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/ModuleConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/ModuleElementDefinition.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/ServiceRegistryWrapper.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/config/Services.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/rpc/InstanceRuntimeRpc.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/rpc/ModuleRpcs.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/runtime/InstanceRuntime.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/runtime/ModuleRuntime.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/runtime/Runtime.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/AbstractConfigNetconfOperation.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/Commit.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/DiscardChanges.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/Validate.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/AbstractEditConfigStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/DeleteEditConfigStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditConfigStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditConfigXmlParser.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditStrategyType.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/MergeEditConfigStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/MissingInstanceHandlingStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/ReplaceEditConfigStrategy.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/get/Get.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/getconfig/GetConfig.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/runtimerpc/RuntimeRpc.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/runtimerpc/RuntimeRpcElementResolved.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/Activator.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationProvider.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceFactoryImpl.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceImpl.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/transactions/TransactionProvider.java
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/NetconfMappingTest.java
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/operations/editconfig/EditConfigTest.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPersisterNotificationHandler.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusher.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/PersisterAggregator.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/PropertiesProviderAdapterImpl.java
opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterActivator.java
opendaylight/netconf/config-persister-impl/src/test/java/org/opendaylight/controller/netconf/persist/impl/osgi/ConfigPersisterTest.java
opendaylight/netconf/ietf-netconf-monitoring/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/netconf/monitoring/rev101004/netconf/state/schemas/LocationBuilder.java
opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfDocumentedException.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClient.java [new file with mode: 0644]
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientDispatcher.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiator.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiatorFactory.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/SimpleNetconfClientSessionListener.java
opendaylight/netconf/netconf-impl/pom.xml
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/CapabilityProviderImpl.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/DefaultCommitNotificationProducer.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionListener.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorFactory.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultCommit.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultGetSchema.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfImplActivator.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfMonitoringServiceImpl.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/NetconfOperationRouterImpl.java
opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ConcurrentClientsTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfMonitoringITTest.java
opendaylight/netconf/netconf-mapping-api/src/main/java/org/opendaylight/controller/netconf/mapping/api/HandlingPriority.java
opendaylight/netconf/netconf-mapping-api/src/main/java/org/opendaylight/controller/netconf/mapping/api/NetconfOperation.java
opendaylight/netconf/netconf-monitoring/pom.xml
opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/Get.java
opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/MonitoringConstants.java
opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringActivator.java
opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/osgi/NetconfMonitoringOperationService.java
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
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/SocketThread.java
opendaylight/netconf/netconf-util/pom.xml
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSession.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSessionNegotiator.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/NetconfUtil.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/exception/MissingNameSpaceException.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/exception/UnexpectedElementException.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/exception/UnexpectedNamespaceException.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ChunkedFramingMechanismEncoder.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/EOMFramingMechanismEncoder.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/FramingMechanismHandlerFactory.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfChunkAggregator.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfEOMAggregator.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageToEXIEncoder.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfXMLToHelloMessageDecoder.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfXMLToMessageDecoder.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/authentication/LoginPassword.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/client/SshClient.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/client/SshClientAdapter.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelInputStream.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/mapping/AbstractLastNetconfOperation.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/mapping/AbstractNetconfOperation.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfHelloMessage.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageConstants.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageUtil.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/SendErrorExceptionUtil.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/osgi/NetconfConfigUtil.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlElement.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlNetconfConstants.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlUtil.java
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/EXILibTest.java [deleted file]
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/NetconfUtilTest.java
opendaylight/samples/simpleforwarding/src/main/java/org/opendaylight/controller/samples/simpleforwarding/internal/SimpleForwardingImpl.java
third-party/org.openexi/nagasena-rta/nagasena-rta-0000.0002.0038.0.jar [moved from third-party/org.openexi/nagasena-rta/nagasena-rta-0000.0002.0035.0.jar with 85% similarity]
third-party/org.openexi/nagasena-rta/pom.xml
third-party/org.openexi/nagasena/nagasena-0000.0002.0038.0.jar [moved from third-party/org.openexi/nagasena/nagasena-0000.0002.0035.0.jar with 80% similarity]
third-party/org.openexi/nagasena/pom.xml
third-party/org.openexi/pom.xml

index 3839d5b..f30d4b0 100644 (file)
   </prerequisites>
 
   <properties>
+    <aopalliance.version>1.0.0</aopalliance.version>
+    <appauth.version>0.4.2-SNAPSHOT</appauth.version>
+    <!-- Controller Modules Versions -->
     <arphandler.version>0.5.2-SNAPSHOT</arphandler.version>
+    <!-- Plugin Versions -->
+    <bouncycastle.version>1.50</bouncycastle.version>
     <bundle.plugin.version>2.3.7</bundle.plugin.version>
     <bundlescanner.version>0.4.2-SNAPSHOT</bundlescanner.version>
     <checkstyle.version>2.10</checkstyle.version>
     <clustering.services.version>0.5.1-SNAPSHOT</clustering.services.version>
     <clustering.services_implementation.version>0.4.3-SNAPSHOT</clustering.services_implementation.version>
     <clustering.stub.version>0.4.2-SNAPSHOT</clustering.stub.version>
+    <clustering.test.version>0.4.2-SNAPSHOT</clustering.test.version>
+    <commmons.northbound.version>0.4.2-SNAPSHOT</commmons.northbound.version>
+    <!-- Third Party Versions -->
+    <commons.codec.version>1.7</commons.codec.version>
+    <commons.fileupload.version>1.2.2</commons.fileupload.version>
     <commons.httpclient.version>0.1.2-SNAPSHOT</commons.httpclient.version>
     <commons.io.version>2.4</commons.io.version>
     <commons.lang.version>3.1</commons.lang.version>
+    <commons.net.version>3.0.1</commons.net.version>
     <compiler.version>2.3.2</compiler.version>
     <concepts.version>0.5.2-SNAPSHOT</concepts.version>
     <config.version>0.2.5-SNAPSHOT</config.version>
+    <configuration.implementation.version>0.4.3-SNAPSHOT</configuration.implementation.version>
     <configuration.version>0.4.3-SNAPSHOT</configuration.version>
     <connectionmanager.version>0.1.2-SNAPSHOT</connectionmanager.version>
     <containermanager.it.version>0.5.2-SNAPSHOT</containermanager.it.version>
+    <containermanager.northbound.version>0.4.2-SNAPSHOT</containermanager.northbound.version>
     <containermanager.version>0.5.2-SNAPSHOT</containermanager.version>
-    <!--versions for bits of the controller -->
+    <controllermanager.northbound.version>0.0.2-SNAPSHOT</controllermanager.northbound.version>
     <corsfilter.version>7.0.42</corsfilter.version>
+    <devices.web.version>0.4.2-SNAPSHOT</devices.web.version>
+    <eclipse.persistence.version>2.5.0</eclipse.persistence.version>
     <!-- enforcer version -->
     <enforcer.version>1.3.1</enforcer.version>
     <enunciate.version>1.26.2</enunciate.version>
     <exam.version>3.0.0</exam.version>
 
     <!-- OpenEXI third party lib for netconf-->
-    <exi.nagasena.version>0000.0002.0035.0-SNAPSHOT</exi.nagasena.version>
+    <exi.nagasena.version>0000.0002.0038.0-SNAPSHOT</exi.nagasena.version>
     <failsafe.version>2.15</failsafe.version>
+    <felix.dependencymanager.shell.version>3.0.1</felix.dependencymanager.shell.version>
+    <felix.dependencymanager.version>3.1.0</felix.dependencymanager.version>
+    <felix.fileinstall.version>3.1.6</felix.fileinstall.version>
+    <felix.webconsole.version>4.2.0</felix.webconsole.version>
+    <flowprogrammer.northbound.version>0.4.2-SNAPSHOT</flowprogrammer.northbound.version>
+    <flows.web.version>0.4.2-SNAPSHOT</flows.web.version>
     <forwarding.staticrouting>0.5.2-SNAPSHOT</forwarding.staticrouting>
+    <forwarding.staticrouting.northbound.version>0.4.2-SNAPSHOT</forwarding.staticrouting.northbound.version>
+    <forwardingrulesmanager.implementation.version>0.4.2-SNAPSHOT</forwardingrulesmanager.implementation.version>
     <forwardingrulesmanager.version>0.6.0-SNAPSHOT</forwardingrulesmanager.version>
     <geminiweb.version>2.2.0.RELEASE</geminiweb.version>
+    <gson.version>2.2.4</gson.version>
     <guava.version>14.0.1</guava.version>
     <hosttracker.api.version>0.5.2-SNAPSHOT</hosttracker.api.version>
     <hosttracker.implementation.version>0.5.2-SNAPSHOT</hosttracker.implementation.version>
+    <hosttracker.northbound.version>0.4.2-SNAPSHOT</hosttracker.northbound.version>
     <hosttracker_new.api.version>0.4.2-SNAPSHOT</hosttracker_new.api.version>
     <ietf-inet-types.version>2010.09.24.4-SNAPSHOT</ietf-inet-types.version>
     <ietf-topology.version>2013.10.21.2-SNAPSHOT</ietf-topology.version>
     <!-- Third party version -->
     <jersey-servlet.version>1.17</jersey-servlet.version>
     <jersey.version>1.17</jersey.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>
     <junit.version>4.8.1</junit.version>
     <logback.version>1.0.9</logback.version>
     <logging.bridge.version>0.4.2-SNAPSHOT</logging.bridge.version>
     <netconf.version>0.2.5-SNAPSHOT</netconf.version>
     <netty.version>4.0.17.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>
+    <networkconfig.neutron.version>0.4.2-SNAPSHOT</networkconfig.neutron.version>
     <!-- ODL repository / plugin repository -->
     <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
     <opendaylight-l2-types.version>2013.08.27.4-SNAPSHOT</opendaylight-l2-types.version>
+    <osgi-brandfragment.web.version>0.0.2-SNAPSHOT</osgi-brandfragment.web.version>
+    <osgi.compendium.version>5.0.0</osgi.compendium.version>
     <osgi.core.version>5.0.0</osgi.core.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
     <projectinfo>2.6</projectinfo>
-
     <propertymavenplugin.version>1.0-alpha-2</propertymavenplugin.version>
     <protocol-framework.version>0.5.0-SNAPSHOT</protocol-framework.version>
-    <protocol_plugin.stub.version>0.4.2-SNAPSHOT</protocol_plugin.stub.version>
+    <protocol_plugins.openflow.version>0.4.2-SNAPSHOT</protocol_plugins.openflow.version>
+    <protocol_plugins.stub.version>0.4.2-SNAPSHOT</protocol_plugins.stub.version>
     <releaseplugin.version>2.3.2</releaseplugin.version>
+    <routing.dijkstra_implementation.version>0.4.2-SNAPSHOT</routing.dijkstra_implementation.version>
     <sal.connection.version>0.1.2-SNAPSHOT</sal.connection.version>
+    <sal.implementation.version>0.4.2-SNAPSHOT</sal.implementation.version>
     <sal.networkconfiguration.version>0.0.3-SNAPSHOT</sal.networkconfiguration.version>
     <sal.version>0.8.1-SNAPSHOT</sal.version>
     <salGeneratorPath>src/main/yang-gen-sal</salGeneratorPath>
     <samples.loadbalancer>0.5.2-SNAPSHOT</samples.loadbalancer>
+    <samples.loadbalancer.northbound.version>0.4.2-SNAPSHOT</samples.loadbalancer.northbound.version>
+    <samples.simpleforwarding.version>0.4.2-SNAPSHOT</samples.simpleforwarding.version>
     <sanitytest.version>0.4.2-SNAPSHOT</sanitytest.version>
+    <security.version>0.4.2-SNAPSHOT</security.version>
     <sitedeploy>dav:http://nexus.opendaylight.org/content/sites/site</sitedeploy>
     <siteplugin>3.2</siteplugin>
     <slf4j.version>1.7.2</slf4j.version>
     <spring-osgi.version>1.2.1</spring-osgi.version>
     <spring-security.version>3.1.3.RELEASE</spring-security.version>
     <spring.version>3.1.3.RELEASE</spring.version>
+    <statistics.northbound.version>0.4.2-SNAPSHOT</statistics.northbound.version>
+    <statisticsmanager.implementation.version>0.4.2-SNAPSHOT</statisticsmanager.implementation.version>
     <statisticsmanager.version>0.5.1-SNAPSHOT</statisticsmanager.version>
+    <subnets.northbound.version>0.4.2-SNAPSHOT</subnets.northbound.version>
     <surefire.version>2.15</surefire.version>
     <switchmanager.api.version>0.7.1-SNAPSHOT</switchmanager.api.version>
+    <switchmanager.implementation.version>0.4.2-SNAPSHOT</switchmanager.implementation.version>
+    <switchmanager.northbound.version>0.4.2-SNAPSHOT</switchmanager.northbound.version>
     <testvm.argLine>-Xmx1024m -XX:MaxPermSize=256m</testvm.argLine>
+    <topology.northbound.version>0.4.2-SNAPSHOT</topology.northbound.version>
+    <topology.web.version>0.4.2-SNAPSHOT</topology.web.version>
     <topologymanager.version>0.4.2-SNAPSHOT</topologymanager.version>
+    <troubleshoot.web.version>0.4.2-SNAPSHOT</troubleshoot.web.version>
     <url.version>1.5.0</url.version>
+    <usermanager.implementation.version>0.4.2-SNAPSHOT</usermanager.implementation.version>
+    <usermanager.northbound.version>0.0.2-SNAPSHOT</usermanager.northbound.version>
     <usermanager.version>0.4.2-SNAPSHOT</usermanager.version>
     <virgo.version>3.6.0.RELEASE</virgo.version>
+    <web.version>0.4.2-SNAPSHOT</web.version>
     <xtend.dstdir>src/main/xtend-gen</xtend.dstdir>
     <xtend.version>2.4.3</xtend.version>
     <yang-ext.version>2013.09.07.4-SNAPSHOT</yang-ext.version>
         <artifactId>logback-core</artifactId>
         <version>${logback.version}</version>
       </dependency>
-
       <dependency>
         <groupId>com.fasterxml.jackson.core</groupId>
         <artifactId>jackson-annotations</artifactId>
         <version>${jackson.version}</version>
       </dependency>
-
       <dependency>
         <groupId>com.fasterxml.jackson.core</groupId>
         <artifactId>jackson-core</artifactId>
         <version>${jackson.version}</version>
       </dependency>
-
       <dependency>
         <groupId>com.fasterxml.jackson.core</groupId>
         <artifactId>jackson-databind</artifactId>
         <version>${jackson.version}</version>
       </dependency>
-
       <dependency>
         <groupId>com.fasterxml.jackson.jaxrs</groupId>
         <artifactId>jackson-jaxrs-base</artifactId>
         <version>${jackson.version}</version>
       </dependency>
-
       <dependency>
         <groupId>com.fasterxml.jackson.jaxrs</groupId>
         <artifactId>jackson-jaxrs-json-provider</artifactId>
         <version>${jackson.version}</version>
       </dependency>
-
       <dependency>
         <groupId>com.fasterxml.jackson.module</groupId>
         <artifactId>jackson-module-jaxb-annotations</artifactId>
       <dependency>
         <groupId>com.google.code.findbugs</groupId>
         <artifactId>jsr305</artifactId>
-        <version>2.0.1</version>
+        <version>${jsr305.api.version}</version>
       </dependency>
       <dependency>
         <groupId>com.google.code.gson</groupId>
         <artifactId>gson</artifactId>
-        <version>2.2.4</version>
+        <version>${gson.version}</version>
       </dependency>
       <dependency>
         <groupId>com.google.guava</groupId>
         <artifactId>jersey-core</artifactId>
         <version>${jersey.version}</version>
       </dependency>
+      <dependency>
+        <groupId>javax.ws.rs</groupId>
+        <artifactId>jsr311-api</artifactId>
+        <version>${jsr311.api.version}</version>
+      </dependency>
       <dependency>
         <groupId>com.sun.jersey</groupId>
         <artifactId>jersey-server</artifactId>
       <dependency>
         <groupId>commons-codec</groupId>
         <artifactId>commons-codec</artifactId>
-        <version>1.7</version>
+        <version>${commons.codec.version}</version>
       </dependency>
       <dependency>
         <groupId>commons-fileupload</groupId>
         <artifactId>commons-fileupload</artifactId>
-        <version>1.2.2</version>
+        <version>${commons.fileupload.version}</version>
       </dependency>
       <dependency>
         <groupId>commons-io</groupId>
       <dependency>
         <groupId>commons-net</groupId>
         <artifactId>commons-net</artifactId>
-        <version>3.0.1</version>
+        <version>${commons.net.version}</version>
       </dependency>
       <dependency>
         <groupId>eclipselink</groupId>
         <artifactId>netty-common</artifactId>
         <version>${netty.version}</version>
       </dependency>
-
-      <!--Netty-->
+      <!-- Netty -->
       <dependency>
         <groupId>io.netty</groupId>
         <artifactId>netty-handler</artifactId>
       <dependency>
         <groupId>org.aopalliance</groupId>
         <artifactId>com.springsource.org.aopalliance</artifactId>
-        <version>1.0.0</version>
+        <version>${aopalliance.version}</version>
       </dependency>
       <dependency>
         <groupId>org.apache.commons</groupId>
       <dependency>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.dependencymanager</artifactId>
-        <version>3.1.0</version>
+        <version>${felix.dependencymanager.version}</version>
       </dependency>
       <dependency>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.dependencymanager.shell</artifactId>
-        <version>3.0.1</version>
+        <version>${felix.dependencymanager.shell.version}</version>
       </dependency>
       <dependency>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.fileinstall</artifactId>
-        <version>3.1.6</version>
+        <version>${felix.fileinstall.version}</version>
       </dependency>
       <!-- felix webconsole -->
       <dependency>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.webconsole</artifactId>
-        <version>4.2.0</version>
+        <version>${felix.webconsole.version}</version>
         <!-- the all bundle includes all the necessary plugins -->
         <classifier>all</classifier>
       </dependency>
       <dependency>
         <groupId>org.bouncycastle</groupId>
         <artifactId>bcpkix-jdk15on</artifactId>
-        <version>1.50</version>
+        <version>${bouncycastle.version}</version>
       </dependency>
       <dependency>
         <groupId>org.bouncycastle</groupId>
         <artifactId>bcprov-jdk15on</artifactId>
-        <version>1.50</version>
+        <version>${bouncycastle.version}</version>
       </dependency>
       <dependency>
         <groupId>org.codehaus.enunciate</groupId>
         <artifactId>enunciate-core-annotations</artifactId>
         <version>${enunciate.version}</version>
       </dependency>
-
       <dependency>
         <groupId>org.codehaus.jettison</groupId>
         <artifactId>jettison</artifactId>
-        <version>1.3.3</version>
+        <version>${jettison.version}</version>
       </dependency>
 
       <!-- equinox http service bridge -->
       <dependency>
         <groupId>org.eclipse.persistence</groupId>
         <artifactId>org.eclipse.persistence.antlr</artifactId>
-        <version>2.5.0</version>
+        <version>${eclipse.persistence.version}</version>
       </dependency>
       <dependency>
         <groupId>org.eclipse.persistence</groupId>
         <artifactId>org.eclipse.persistence.core</artifactId>
-        <version>2.5.0</version>
+        <version>${eclipse.persistence.version}</version>
       </dependency>
       <dependency>
         <groupId>org.eclipse.persistence</groupId>
         <artifactId>org.eclipse.persistence.moxy</artifactId>
-        <version>2.5.0</version>
+        <version>${eclipse.persistence.version}</version>
       </dependency>
 
       <!-- md-sal -->
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>appauth</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${appauth.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>clustering.test</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${clustering.test.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>commons.northbound</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${commmons.northbound.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>configuration.implementation</artifactId>
-        <version>0.4.3-SNAPSHOT</version>
+        <version>${configuration.implementation.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>containermanager.northbound</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${containermanager.northbound.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>controllermanager.northbound</artifactId>
-        <version>0.0.2-SNAPSHOT</version>
+        <version>${controllermanager.northbound.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>devices.web</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${devices.web.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>flowprogrammer.northbound</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${flowprogrammer.northbound.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>flows.web</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${flows.web.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>forwarding.staticrouting.northbound</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${forwarding.staticrouting.northbound.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>forwardingrulesmanager.implementation</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${forwardingrulesmanager.implementation.version}</version>
       </dependency>
 
       <dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>hosttracker.northbound</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${hosttracker.northbound.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>networkconfig.neutron</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${networkconfig.neutron.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>networkconfig.neutron.implementation</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${networkconfig.neutron.implementation.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>networkconfig.neutron.northbound</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${networkconfig.neutron.northbound.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>osgi-brandfragment.web</artifactId>
-        <version>0.0.2-SNAPSHOT</version>
+        <version>${osgi-brandfragment.web.version}</version>
       </dependency>
 
       <dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>protocol_plugins.openflow</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${protocol_plugins.openflow.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>protocol_plugins.stub</artifactId>
-        <version>${protocol_plugin.stub.version}</version>
+        <version>${protocol_plugins.stub.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>routing.dijkstra_implementation</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${routing.dijkstra_implementation.version}</version>
       </dependency>
 
       <!-- SAL bundles -->
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>sal.implementation</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${sal.implementation.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>samples.loadbalancer.northbound</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${samples.loadbalancer.northbound.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>samples.simpleforwarding</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${samples.simpleforwarding.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>security</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${security.version}</version>
       </dependency>
 
       <dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>statistics.northbound</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${statistics.northbound.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>statisticsmanager.implementation</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${statisticsmanager.implementation.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>subnets.northbound</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${subnets.northbound.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>switchmanager.implementation</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${switchmanager.implementation.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>switchmanager.northbound</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${switchmanager.northbound.version}</version>
       </dependency>
 
       <!-- threadpool -->
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>topology.northbound</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${topology.northbound.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>topology.web</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${topology.web.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>troubleshoot.web</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${troubleshoot.web.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>usermanager.implementation</artifactId>
-        <version>${usermanager.version}</version>
+        <version>${usermanager.implementation.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>usermanager.northbound</artifactId>
-        <version>0.0.2-SNAPSHOT</version>
+        <version>${usermanager.northbound.version}</version>
       </dependency>
 
       <!--  Web bundles -->
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>web</artifactId>
-        <version>0.4.2-SNAPSHOT</version>
+        <version>${web.version}</version>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
       <dependency>
         <groupId>org.osgi</groupId>
         <artifactId>org.osgi.compendium</artifactId>
-        <version>${osgi.core.version}</version>
+        <version>${osgi.compendium.version}</version>
       </dependency>
       <dependency>
         <groupId>org.osgi</groupId>
index 2df07b1..3d4757b 100644 (file)
@@ -26,4 +26,14 @@ public class PropertiesProviderTest implements PropertiesProvider {
     public String getFullKeyForReporting(String key) {
         return null;
     }
+
+    @Override
+    public String getPrefix() {
+        return null;
+    }
+
+    @Override
+    public String getPropertyWithoutPrefix(String fullKey) {
+        return null;
+    }
 }
diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/DepTestImplModuleFactory.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/DepTestImplModuleFactory.java
new file mode 100644 (file)
index 0000000..ae6ae67
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+*
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0 which accompanies this distribution,
+* and is available at http://www.eclipse.org/legal/epl-v10.html
+*/
+/*
+* Generated file
+*
+* Generated from: yang module name: config-test-impl yang module local name: impl-dep
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri Apr 25 11:50:32 CEST 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.test.impl;
+public class DepTestImplModuleFactory extends org.opendaylight.controller.config.yang.test.impl.AbstractDepTestImplModuleFactory {
+
+}
diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/IdentityTestModuleFactory.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/IdentityTestModuleFactory.java
new file mode 100644 (file)
index 0000000..0701226
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+*
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0 which accompanies this distribution,
+* and is available at http://www.eclipse.org/legal/epl-v10.html
+*/
+/*
+* Generated file
+*
+* Generated from: yang module name: config-test-impl yang module local name: impl-identity-test
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri Apr 25 11:50:32 CEST 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.test.impl;
+public class IdentityTestModuleFactory extends org.opendaylight.controller.config.yang.test.impl.AbstractIdentityTestModuleFactory {
+
+}
diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleFactory.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/NetconfTestImplModuleFactory.java
new file mode 100644 (file)
index 0000000..3baee6c
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+*
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0 which accompanies this distribution,
+* and is available at http://www.eclipse.org/legal/epl-v10.html
+*/
+/*
+* Generated file
+*
+* Generated from: yang module name: config-test-impl yang module local name: impl-netconf
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri Apr 25 11:50:32 CEST 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.test.impl;
+public class NetconfTestImplModuleFactory extends org.opendaylight.controller.config.yang.test.impl.AbstractNetconfTestImplModuleFactory {
+
+}
diff --git a/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/TestImplModuleFactory.java b/opendaylight/config/yang-test/src/main/java/org/opendaylight/controller/config/yang/test/impl/TestImplModuleFactory.java
new file mode 100644 (file)
index 0000000..6f9118b
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+*
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0 which accompanies this distribution,
+* and is available at http://www.eclipse.org/legal/epl-v10.html
+*/
+/*
+* Generated file
+*
+* Generated from: yang module name: config-test-impl yang module local name: impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri Apr 25 11:50:32 CEST 2014
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.test.impl;
+public class TestImplModuleFactory extends org.opendaylight.controller.config.yang.test.impl.AbstractTestImplModuleFactory {
+
+}
index 2365c70..686d363 100644 (file)
@@ -1,3 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
 <snapshot>
     <required-capabilities>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:netty?module=netty&amp;revision=2013-11-19</capability>
index 7853b86..c5f99fd 100644 (file)
@@ -1,3 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
 <snapshot>
     <configuration>
         <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
index c481485..6d5d0eb 100644 (file)
@@ -1,3 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
 <snapshot>
     <configuration>
         <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
diff --git a/opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/04-netconf-connector.xml b/opendaylight/distribution/opendaylight/src/main/resources/configuration/initial/04-netconf-connector.xml
new file mode 100644 (file)
index 0000000..8143a38
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<snapshot>
+  <configuration>
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+      <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+    <module>
+      <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">prefix:sal-netconf-connector</type>
+      <name>controller-config</name>
+      <port xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">1830</port>
+      <username xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">admin</username>
+      <worker-thread-group xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
+        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-threadgroup</type>
+        <name>global-worker-group</name>
+      </worker-thread-group>
+      <address xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">127.0.0.1</address>
+      <tcp-only xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">false</tcp-only>
+      <event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
+        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type>
+        <name>global-event-executor</name>
+      </event-executor>
+      <password xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">admin</password>
+      <boss-thread-group xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
+        <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-threadgroup</type>
+        <name>global-boss-group</name>
+      </boss-thread-group>
+      <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>
+      </dom-registry>
+    </module>
+      </modules>
+    </data>
+  </configuration>
+  <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>
+  </required-capabilities>
+</snapshot>
index 6a9712b..75cbf49 100644 (file)
@@ -113,6 +113,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie
 
 public class MDFlowMapping {
 
@@ -127,7 +128,7 @@ public class MDFlowMapping {
 
         hardTimeout = sourceFlow.hardTimeout as int
         idleTimeout = sourceFlow.idleTimeout as int
-        cookie = BigInteger.valueOf(sourceFlow.id)
+        cookie = new FlowCookie(BigInteger.valueOf(sourceFlow.id))
         priority = sourceFlow.priority as int
 
         val sourceActions = sourceFlow.actions;
@@ -150,7 +151,7 @@ public class MDFlowMapping {
        val it = new FlowBuilder();
        hardTimeout = sourceFlow.hardTimeout as int
        idleTimeout = sourceFlow.idleTimeout as int
-       cookie = BigInteger.valueOf(sourceFlow.id)
+       cookie = new FlowCookie(BigInteger.valueOf(sourceFlow.id))
        priority = sourceFlow.priority as int
        id = new FlowId(flowId)
     
@@ -404,7 +405,7 @@ public class MDFlowMapping {
 
         hardTimeout = sourceFlow.hardTimeout as int
         idleTimeout = sourceFlow.idleTimeout as int
-        cookie = BigInteger.valueOf(sourceFlow.id)
+        cookie = new FlowCookie(BigInteger.valueOf(sourceFlow.id))
         priority = sourceFlow.priority as int
 
         val sourceActions = sourceFlow.actions;
index b062b00..63c5664 100644 (file)
@@ -177,7 +177,7 @@ public class TestFromSalConversionsUtils {
     }
 
     private void checkOdFlow(NodeFlow odNodeFlow) {
-        assertEquals("Cookie is incorrect.", 9223372036854775807L, odNodeFlow.getCookie().longValue());
+        assertEquals("Cookie is incorrect.", 9223372036854775807L, odNodeFlow.getCookie().getValue().longValue());
         assertEquals("Hard timeout is incorrect.", 32765, odNodeFlow.getHardTimeout().shortValue());
         assertEquals("Iddle timeout is incorrect.", 32766, odNodeFlow.getIdleTimeout().shortValue());
         assertEquals("Priority is incorrect.", 32767, odNodeFlow.getPriority().shortValue());
index ca16c65..71f2e94 100644 (file)
@@ -105,6 +105,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.addr
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAddedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeFlow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
@@ -347,7 +348,7 @@ public class TestToSalConversionsUtils {
     private FlowAddedBuilder prepareOdFlowCommon() {
         FlowAddedBuilder odNodeFlowBuilder = new FlowAddedBuilder();
 
-        odNodeFlowBuilder.setCookie(new BigInteger("9223372036854775807"));
+        odNodeFlowBuilder.setCookie(new FlowCookie(new BigInteger("9223372036854775807")));
         odNodeFlowBuilder.setHardTimeout(32767);
         odNodeFlowBuilder.setIdleTimeout(32767);
         odNodeFlowBuilder.setPriority(32767);
index 02bdd1a..0d8a0b6 100644 (file)
@@ -15,6 +15,11 @@ module opendaylight-flow-types {
         type instance-identifier;
     }
     
+    typedef flow-cookie {
+        description "openflow specific type - flow cookie / flow cookie mask";
+        type uint64;
+    }
+    
     typedef output-port-values {
         type enumeration {
             enum MAX {
@@ -143,7 +148,7 @@ module opendaylight-flow-types {
         }
         
         leaf cookie {
-            type uint64;
+            type flow-cookie;
         }
         
         leaf table_id {
@@ -167,7 +172,7 @@ module opendaylight-flow-types {
         }
         
         leaf cookie_mask {
-            type uint64;
+            type flow-cookie;
         }
         
         leaf buffer_id {
diff --git a/opendaylight/md-sal/model/model-flow-service/src/main/yang/node-errors.yang b/opendaylight/md-sal/model/model-flow-service/src/main/yang/node-errors.yang
new file mode 100644 (file)
index 0000000..a8eec26
--- /dev/null
@@ -0,0 +1,168 @@
+module node-error {
+    namespace "urn:opendaylight:node:error:service";
+    prefix node-error;
+
+    import sal-flow {prefix flow; revision-date "2013-08-19";}
+    import flow-errors {prefix error;}
+    import flow-capable-transaction {prefix tr;}
+    import yang-ext {prefix ext; revision-date "2013-07-09";}
+    import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
+    import opendaylight-flow-types {prefix types;revision-date "2013-10-26";}
+    import opendaylight-group-types {prefix group-type;revision-date 2013-10-18;}
+    import opendaylight-meter-types {prefix meter-type;revision-date "2013-09-18";}
+
+    revision "2014-04-10" {
+        description "Initial revision of errors received from a node";
+    }
+
+    notification hello-failed-error-notification {
+        description "Model for ofp_error-Type=0, Hello protocol failed";
+
+        uses error:error-message;
+        uses tr:transaction-aware;
+        uses tr:transaction-metadata;
+        uses flow:base-node-error-notification;
+        uses flow:node-error-reference;
+    }
+
+    notification bad-request-error-notification {
+        description "Model for ofp_error-Type=1, Request was not understood.";
+
+        uses error:error-message;
+        uses tr:transaction-aware;
+        uses tr:transaction-metadata;
+        uses flow:base-node-error-notification;
+        uses flow:node-error-reference;
+    }
+
+    notification bad-action-error-notification {
+        description "Model for ofp_error-Type=2, Error in action description.";
+
+        uses error:error-message;
+        uses tr:transaction-aware;
+        uses tr:transaction-metadata;
+        uses flow:base-node-error-notification;
+        uses flow:node-error-reference;
+    }
+
+    notification bad-instruction-error-notification {
+            description "Model for ofp_error-Type=3, Error in instruction list.";
+
+            uses error:error-message;
+            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            uses flow:base-node-error-notification;
+            uses flow:node-error-reference;
+        }
+
+    notification bad-match-error-notification {
+            description "Model for ofp_error-Type=4, Error in match.";
+
+            uses error:error-message;
+            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            uses flow:base-node-error-notification;
+            uses flow:node-error-reference;
+        }
+
+    notification flow-mod-error-notification {
+            description "Model for ofp_error-Type=5 - Problem modifying flow entry.";
+
+            uses error:error-message;
+            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            uses flow:base-node-error-notification;
+            uses flow:node-error-reference;
+            uses flow:node-error-reference;
+        }
+
+    notification group-mod-error-notification {
+            description "Model for ofp_error-Type=6 - Problem modifying group entry.";
+
+            uses error:error-message;
+            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            uses flow:base-node-error-notification;
+            uses flow:node-error-reference;
+        }
+
+    notification port-mod-error-notification {
+            description "Model for ofp_error-Type=7 - Port mod request failed.";
+
+            uses error:error-message;
+            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            uses flow:base-node-error-notification;
+            uses flow:node-error-reference;
+        }
+
+    notification table-mod-error-notification {
+            description "Model for ofp_error-Type=8 - Table mod request failed.";
+
+            uses error:error-message;
+            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            uses flow:base-node-error-notification;
+            uses flow:node-error-reference;
+        }
+
+    notification queue-op-error-notification {
+            description "Model for ofp_error-Type=9 - Queue operation failed.";
+
+            uses error:error-message;
+            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            uses flow:base-node-error-notification;
+            uses flow:node-error-reference;
+        }
+
+    notification switch-config-error-notification {
+            description "Model for ofp_error-Type=10 - Switch Config request failed.";
+
+            uses error:error-message;
+            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            uses flow:base-node-error-notification;
+            uses flow:node-error-reference;
+        }
+
+    notification role-request-error-notification {
+            description "Model for ofp_error-Type=11 - Controller Role request failed.";
+
+            uses error:error-message;
+            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            uses flow:base-node-error-notification;
+            uses flow:node-error-reference;
+        }
+
+    notification meter-mod-error-notification {
+            description "Model for ofp_error-Type=12 - Error in meter.";
+
+            uses error:error-message;
+            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            uses flow:base-node-error-notification;
+            uses flow:node-error-reference;
+        }
+
+    notification table-features-error-notification {
+            description "Model for ofp_error-Type=13 - Setting table features failed.";
+
+            uses error:error-message;
+            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            uses flow:base-node-error-notification;
+            uses flow:node-error-reference;
+        }
+
+    notification experimenter-error-notification {
+            description "Model for ofp_error-Type=65535  - Experimenter Error Messages";
+            uses error:error-message;
+            uses tr:transaction-aware;
+            uses tr:transaction-metadata;
+            uses flow:base-node-error-notification;
+            uses flow:node-error-reference;
+        }
+}
+
index f3db318..50368e4 100644 (file)
@@ -9,13 +9,14 @@ module packet-processing {
     import opendaylight-match-types {prefix match-type;revision-date "2013-10-26";}
     import opendaylight-table-types {prefix table-type;revision-date "2013-10-26";}
     import opendaylight-action-types {prefix action-type;revision-date "2013-11-12";}
+    import opendaylight-flow-types {prefix flow-type;revision-date "2013-10-26";}
 
     
     revision "2013-07-09" {
         description "";
     }
 
-    typedef cookie {
+    typedef connection-cookie {
         type uint32;
     }
 
@@ -58,8 +59,12 @@ module packet-processing {
     }
 
     notification packet-received {
-       leaf cookie {
-                type cookie;
+       leaf connection-cookie {
+                type connection-cookie;
+        }
+        
+        leaf flow-cookie {
+            type flow-type:flow-cookie;
         }
         
         leaf table-id {
@@ -83,14 +88,14 @@ module packet-processing {
        input {
             uses inv:node-context-ref;
 
-            leaf cookie {
-                type cookie;
+            leaf connection-cookie {
+                type connection-cookie;
             }
             
                leaf egress {
                        type inv:node-connector-ref;
                }
-               leaf buffer-id {
+            leaf buffer-id {
                   type uint32;
             }
 
index b3e6e45..4cb1d08 100644 (file)
@@ -38,6 +38,33 @@ module sal-flow {
         uses types:flow;
     }
 
+    grouping base-node-error-notification {
+        leaf node {
+            ext:context-reference "inv:node-context";
+                type inv:node-ref;
+        }
+    }
+
+    grouping node-error-reference {
+        choice object-reference {
+            case flow-ref{
+                leaf flow-ref {
+                        type types:flow-ref;
+                }
+            }
+            case group-ref{
+                leaf group-ref {
+                    type group-type:group-ref;
+                }
+            }
+            case meter-ref{
+                leaf meter-ref {
+                    type meter-type:meter-ref;
+                }
+            }
+        }
+    }
+
     /** Base configuration structure **/
     grouping flow-update {
         uses "inv:node-context-ref";
@@ -124,28 +151,8 @@ module sal-flow {
         uses error:error-message;
         uses tr:transaction-aware;
         uses tr:transaction-metadata;
-        choice object-reference {
-        case flow-ref{
-                   leaf flow-ref {
-            type types:flow-ref;
-         }
-       }
-        case group-ref{
-                   leaf group-ref {
-            type group-type:group-ref;
-         }
-       }
-        case meter-ref{
-                   leaf meter-ref {
-            type meter-type:meter-ref;
-         }
-       }
-     }
-        leaf node {
-            ext:context-reference "inv:node-context";
-            type inv:node-ref;
-        }
-        
+        uses node-error-reference;
+        uses base-node-error-notification;
     }
     
     notification node-experimenter-error-notification {
index 6334457..6bd6e6a 100644 (file)
@@ -132,7 +132,7 @@ public class AbstractForwardedTransaction<T extends AsyncTransaction<org.openday
             }
 
             if (!d.isPresent() && iterator.hasNext()) {
-                writeTransaction.put(store, currentPath, currentOp.createDefault(currentArg));
+                writeTransaction.merge(store, currentPath, currentOp.createDefault(currentArg));
             }
         }
         //LOG .info("Tx: {} : Putting data {}",getDelegate().getIdentifier(),normalized.getKey());
index 4deef69..ac26445 100644 (file)
@@ -7,22 +7,22 @@
  */
 package org.opendaylight.controller.sal.binding.codegen.impl;
 
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import javassist.ClassPool;
+import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeGenerator;
+import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory;
+
+import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.RejectedExecutionHandler;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
-import javassist.ClassPool;
-
-import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeGenerator;
-import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory;
-
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-
 public class SingletonHolder {
 
     public static final ClassPool CLASS_POOL = ClassPool.getDefault();
@@ -45,12 +45,43 @@ public class SingletonHolder {
      */
     @Deprecated
     public static synchronized final ListeningExecutorService getDefaultNotificationExecutor() {
+
         if (NOTIFICATION_EXECUTOR == null) {
+            // Overriding the queue since we need an unbounded queue
+            // and threadpoolexecutor would not create new threads if the queue is not full
+            BlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>() {
+                @Override
+                public boolean offer(Runnable r) {
+                    if (size() <= 1) {
+                        // if the queue is empty (or has just 1), no need to rampup the threads
+                        return super.offer(r);
+                    } else {
+                        // if the queue is not empty, force the queue to return false.
+                        // threadpoolexecutor will spawn a new thread if the queue.offer returns false.
+                        return false;
+                    }
+                }
+            };
+
             ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("md-sal-binding-notification-%d").build();
-            ExecutorService executor = new ThreadPoolExecutor(CORE_NOTIFICATION_THREADS, MAX_NOTIFICATION_THREADS,
-                    NOTIFICATION_THREAD_LIFE, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), factory);
+
+            ThreadPoolExecutor executor = new ThreadPoolExecutor(CORE_NOTIFICATION_THREADS, MAX_NOTIFICATION_THREADS,
+                    NOTIFICATION_THREAD_LIFE, TimeUnit.SECONDS, queue , factory,
+                    new RejectedExecutionHandler() {
+                        // if the max threads are met, then it will raise a rejectedExecution. We then push to the queue.
+                        @Override
+                        public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
+                            try {
+                                executor.getQueue().put(r);
+                            } catch (InterruptedException e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    });
+
             NOTIFICATION_EXECUTOR = MoreExecutors.listeningDecorator(executor);
         }
+
         return NOTIFICATION_EXECUTOR;
     }
 
diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ConcurrentImplicitCreateTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ConcurrentImplicitCreateTest.java
new file mode 100644 (file)
index 0000000..61a73d6
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.md.sal.binding.data;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.junit.Test;
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+public class ConcurrentImplicitCreateTest extends AbstractDataServiceTest {
+
+    private static final NodeKey NODE_FOO_KEY = new NodeKey(new NodeId("foo"));
+    private static final NodeKey NODE_BAR_KEY = new NodeKey(new NodeId("foo"));
+    private static InstanceIdentifier<Nodes> NODES_PATH = InstanceIdentifier.builder(Nodes.class).build();
+    private static InstanceIdentifier<Node> NODE_FOO_PATH = InstanceIdentifier.builder(NODES_PATH)
+            .child(Node.class, NODE_FOO_KEY).build();
+    private static InstanceIdentifier<Node> NODE_BAR_PATH = InstanceIdentifier.builder(NODES_PATH)
+            .child(Node.class, NODE_FOO_KEY).build();
+
+    @Test
+    public void testConcurrentCreate() throws InterruptedException, ExecutionException {
+
+        DataModificationTransaction fooTx = baDataService.beginTransaction();
+        DataModificationTransaction barTx = baDataService.beginTransaction();
+
+        fooTx.putOperationalData(NODE_FOO_PATH, new NodeBuilder().setKey(NODE_FOO_KEY).build());
+        barTx.putOperationalData(NODE_BAR_PATH, new NodeBuilder().setKey(NODE_BAR_KEY).build());
+
+        Future<RpcResult<TransactionStatus>> fooFuture = fooTx.commit();
+        Future<RpcResult<TransactionStatus>> barFuture = barTx.commit();
+
+        RpcResult<TransactionStatus> fooResult = fooFuture.get();
+        RpcResult<TransactionStatus> barResult = barFuture.get();
+
+        assertTrue(fooResult.isSuccessful());
+        assertTrue(barResult.isSuccessful());
+
+        assertEquals(TransactionStatus.COMMITED, fooResult.getResult());
+        assertEquals(TransactionStatus.COMMITED, barResult.getResult());
+
+    }
+}
index b23ceaa..9519a2a 100644 (file)
@@ -31,6 +31,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.Node
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeExperimenterErrorNotification;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SwitchFlowRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.NotificationListener;
 import org.opendaylight.yangtools.yang.binding.RpcService;
@@ -99,7 +100,7 @@ public class NoficationTest extends AbstractTest {
          *
          */
         assertEquals(1, listener1.addedFlows.size());
-        assertEquals(0, listener1.addedFlows.get(0).getCookie().intValue());
+        assertEquals(0, listener1.addedFlows.get(0).getCookie().getValue().intValue());
 
         /**
          * The registration of the Consumer 2. SalFlowListener is registered
@@ -196,7 +197,7 @@ public class NoficationTest extends AbstractTest {
      */
     public static FlowAdded flowAdded(int i) {
         FlowAddedBuilder ret = new FlowAddedBuilder();
-        ret.setCookie(BigInteger.valueOf(i));
+        ret.setCookie(new FlowCookie(BigInteger.valueOf(i)));
         return ret.build();
     }
 
index 9c24ca0..d49d6f0 100644 (file)
@@ -26,6 +26,7 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
@@ -209,7 +210,7 @@ public class RoutedServiceTest extends AbstractTest {
     static AddFlowInput createSampleAddFlow(NodeRef node, int cookie) {
         AddFlowInputBuilder ret = new AddFlowInputBuilder();
         ret.setNode(node);
-        ret.setCookie(BigInteger.valueOf(cookie));
+        ret.setCookie(new FlowCookie(BigInteger.valueOf(cookie)));
         return ret.build();
     }
 }
index 64a5606..608ac9b 100644 (file)
@@ -217,8 +217,7 @@ public class DOMDataBrokerImpl implements DOMDataBroker, AutoCloseable {
         @Override
         public void merge(final LogicalDatastoreType store, final InstanceIdentifier path,
                 final NormalizedNode<?, ?> data) {
-            // TODO Auto-generated method stub
-            throw new UnsupportedOperationException("Not implemented yet.");
+            getSubtransaction(store).merge(path,data);
         }
 
         @Override
@@ -251,12 +250,6 @@ public class DOMDataBrokerImpl implements DOMDataBroker, AutoCloseable {
                 final InstanceIdentifier path) {
             return getSubtransaction(store).read(path);
         }
-
-        @Override
-        public void merge(final LogicalDatastoreType store, final InstanceIdentifier path,
-                final NormalizedNode<?, ?> data) {
-
-        }
     }
 
     private final class CommitCoordination implements Callable<RpcResult<TransactionStatus>> {
index b905d2f..29f2af5 100644 (file)
@@ -32,21 +32,13 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Iterables;
 import com.google.common.util.concurrent.ListenableFuture;
 
 public abstract class BackwardsCompatibleTransaction<T extends DOMDataReadTransaction> implements
@@ -249,7 +241,7 @@ public abstract class BackwardsCompatibleTransaction<T extends DOMDataReadTransa
                 InstanceIdentifier currentPath = new InstanceIdentifier(currentArguments);
                 boolean isPresent = getDelegate().read(store, currentPath).get().isPresent();
                 if(isPresent == false && iterator.hasNext()) {
-                    getDelegate().put(store, currentPath, currentOp.createDefault(currentArg));
+                    getDelegate().merge(store, currentPath, currentOp.createDefault(currentArg));
                 }
             }
             } catch (InterruptedException | ExecutionException e) {
@@ -259,48 +251,6 @@ public abstract class BackwardsCompatibleTransaction<T extends DOMDataReadTransa
             getDelegate().put(store, normalizedPath, normalizedData);
         }
 
-        private boolean isAugmentationChild(final InstanceIdentifier normalizedPath) {
-            List<PathArgument> parentArgs = parentPath(normalizedPath).getPath();
-            if(parentArgs.isEmpty()) {
-                return false;
-            }
-            return Iterables.getLast(parentArgs) instanceof AugmentationIdentifier;
-        }
-
-        private void ensureParentNode(final LogicalDatastoreType store, final InstanceIdentifier normalizedPath,
-                final NormalizedNode<?, ?> normalizedData) {
-            InstanceIdentifier parentPath = parentPath(normalizedPath);
-            PathArgument parentType = Iterables.getLast(parentPath.getPath());
-            if(parentType instanceof AugmentationIdentifier) {
-                AugmentationNode node = Builders.augmentationBuilder()
-                        .withNodeIdentifier((AugmentationIdentifier) parentType)
-                        .build();
-                getDelegate().put(store, parentPath, node);
-            }
-            if(normalizedData instanceof MapEntryNode) {
-                MapNode mapNode = Builders.mapBuilder().withNodeIdentifier(new NodeIdentifier(normalizedData.getNodeType())).build();
-                getDelegate().put(store, parentPath, mapNode);
-            } else if (normalizedData instanceof LeafSetNode<?>){
-                LeafSetNode<Object> leafNode = Builders.leafSetBuilder().withNodeIdentifier(new NodeIdentifier(normalizedData.getNodeType())).build();
-                getDelegate().put(store, parentPath, leafNode);
-            }
-
-
-        }
-
-        private InstanceIdentifier parentPath(final InstanceIdentifier normalizedPath) {
-            List<PathArgument> childArgs = normalizedPath.getPath();
-            return new InstanceIdentifier(childArgs.subList(0, childArgs.size() -1));
-        }
-
-        private boolean parentNodeDoesNotExists(final LogicalDatastoreType store, final InstanceIdentifier normalizedPath) {
-            try {
-                return !getDelegate().read(store, parentPath(normalizedPath)).get().isPresent();
-            } catch (InterruptedException | ExecutionException e) {
-                throw new IllegalStateException(e);
-            }
-        }
-
         @Override
         public void removeConfigurationData(final InstanceIdentifier legacyPath) {
             checkNotNull(legacyPath, "Path MUST NOT be null.");
index 6c0e582..9bbba1e 100644 (file)
@@ -258,6 +258,18 @@ public class InMemoryDOMDataStore implements DOMStore, Identifiable<String>, Sch
             }
         }
 
+        @Override
+        public void merge(final InstanceIdentifier path, final NormalizedNode<?, ?> data) {
+            checkNotReady();
+            try {
+                LOG.trace("Tx: {} Merge: {}:{}",getIdentifier(),path,data);
+                mutableTree.merge(path, data);
+              // FIXME: Add checked exception
+            } catch (Exception e) {
+                LOG.error("Tx: {}, failed to write {}:{} in {}",getIdentifier(),path,data,mutableTree,e);
+            }
+        }
+
         @Override
         public void delete(final InstanceIdentifier path) {
             checkNotReady();
index bc7fe7a..b711163 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.controller.md.sal.dom.store.impl.tree.TreeNodeUtils;
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
 import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -47,6 +48,24 @@ class MutableDataTree {
         resolveModificationFor(path).write(value);
     }
 
+    public void merge(final InstanceIdentifier path, final NormalizedNode<?, ?> data) {
+        checkSealed();
+        mergeImpl(resolveModificationFor(path),data);
+    }
+
+    private void mergeImpl(final OperationWithModification op,final NormalizedNode<?,?> data) {
+
+        if(data instanceof NormalizedNodeContainer<?,?,?>) {
+            @SuppressWarnings({ "rawtypes", "unchecked" })
+            NormalizedNodeContainer<?,?,NormalizedNode<PathArgument, ?>> dataContainer = (NormalizedNodeContainer) data;
+            for(NormalizedNode<PathArgument, ?> child : dataContainer.getValue()) {
+                PathArgument childId = child.getIdentifier();
+                mergeImpl(op.forChild(childId), child);
+            }
+        }
+        op.merge(data);
+    }
+
     public void delete(final InstanceIdentifier path) {
         checkSealed();
         resolveModificationFor(path).delete();
index eaf01ae..35864b6 100644 (file)
@@ -2,6 +2,7 @@ package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import org.opendaylight.controller.md.sal.dom.store.impl.tree.NodeModification;
 import org.opendaylight.controller.md.sal.dom.store.impl.tree.StoreMetadataNode;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import com.google.common.base.Optional;
@@ -10,6 +11,7 @@ import com.google.common.primitives.UnsignedLong;
 public class OperationWithModification {
 
     private final NodeModification modification;
+
     private final ModificationApplyOperation applyOperation;
 
     private OperationWithModification(final ModificationApplyOperation op, final NodeModification mod) {
@@ -28,6 +30,14 @@ public class OperationWithModification {
         return this;
     }
 
+    public NodeModification getModification() {
+        return modification;
+    }
+
+    public ModificationApplyOperation getApplyOperation() {
+        return applyOperation;
+    }
+
     public boolean isApplicable(final Optional<StoreMetadataNode> data) {
         return applyOperation.isApplicable(modification, data);
     }
@@ -41,4 +51,16 @@ public class OperationWithModification {
         return new OperationWithModification(operation, modification);
 
     }
+
+    public void merge(final NormalizedNode<?, ?> data) {
+        modification.merge(data);
+        applyOperation.verifyStructure(modification);
+
+    }
+
+    public OperationWithModification forChild(final PathArgument childId) {
+        NodeModification childMod = modification.modifyChild(childId);
+        Optional<ModificationApplyOperation> childOp = applyOperation.getChild(childId);
+        return from(childOp.get(),childMod);
+    }
 }
\ No newline at end of file
index 520bd1b..c62c27d 100644 (file)
@@ -308,6 +308,7 @@ public class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeList
         switch (modification.getModificationType()) {
         case SUBTREE_MODIFIED:
             return resolveSubtreeChangeEvent(path, listeners, modification, before.get(), after.get());
+        case MERGE:
         case WRITE:
             if (before.isPresent()) {
                 return resolveReplacedEvent(path, listeners, before.get().getData(), after.get().getData());
@@ -487,6 +488,7 @@ public class ResolveDataChangeEventsTask implements Callable<Iterable<ChangeList
 
             switch (childMod.getModificationType()) {
             case WRITE:
+            case MERGE:
             case DELETE:
                 one.merge(resolveAnyChangeEvent(childPath, childListeners, childMod, childBefore, childAfter));
                 break;
index b9b1ab0..a5c9b79 100644 (file)
@@ -131,6 +131,8 @@ public abstract class SchemaAwareApplyOperation implements ModificationApplyOper
             return isSubtreeModificationApplicable(modification, current);
         case WRITE:
             return isWriteApplicable(modification, current);
+        case MERGE:
+            return isMergeApplicable(modification,current);
         case UNMODIFIED:
             return true;
         default:
@@ -138,6 +140,16 @@ public abstract class SchemaAwareApplyOperation implements ModificationApplyOper
         }
     }
 
+    private boolean isMergeApplicable(final NodeModification modification, final Optional<StoreMetadataNode> current) {
+        Optional<StoreMetadataNode> original = modification.getOriginal();
+        if (original.isPresent() && current.isPresent()) {
+            return isNotConflicting(original.get(), current.get());
+        } else if (current.isPresent()) {
+            return true;
+        }
+        return true;
+    }
+
     protected boolean isWriteApplicable(final NodeModification modification, final Optional<StoreMetadataNode> current) {
         Optional<StoreMetadataNode> original = modification.getOriginal();
         if (original.isPresent() && current.isPresent()) {
@@ -174,6 +186,10 @@ public abstract class SchemaAwareApplyOperation implements ModificationApplyOper
                     modification);
             return modification.storeSnapshot(Optional.of(applySubtreeChange(modification, currentMeta.get(),
                     subtreeVersion)));
+        case MERGE:
+            if(currentMeta.isPresent()) {
+                return modification.storeSnapshot(Optional.of(applyMerge(modification,currentMeta.get(),subtreeVersion)));
+            } // Fallback to write is intentional - if node is not preexisting merge is same as write
         case WRITE:
             return modification.storeSnapshot(Optional.of(applyWrite(modification, currentMeta, subtreeVersion)));
         case UNMODIFIED:
@@ -183,6 +199,9 @@ public abstract class SchemaAwareApplyOperation implements ModificationApplyOper
         }
     }
 
+    protected abstract StoreMetadataNode applyMerge(NodeModification modification,
+            StoreMetadataNode currentMeta, UnsignedLong subtreeVersion);
+
     protected abstract StoreMetadataNode applyWrite(NodeModification modification,
             Optional<StoreMetadataNode> currentMeta, UnsignedLong subtreeVersion);
 
@@ -219,14 +238,16 @@ public abstract class SchemaAwareApplyOperation implements ModificationApplyOper
                     + "is leaf type node. Subtree change is not allowed.");
         }
 
+        @Override
+        protected StoreMetadataNode applyMerge(final NodeModification modification, final StoreMetadataNode currentMeta,
+                final UnsignedLong subtreeVersion) {
+            return applyWrite(modification, Optional.of(currentMeta), subtreeVersion);
+        }
+
         @Override
         protected StoreMetadataNode applyWrite(final NodeModification modification,
                 final Optional<StoreMetadataNode> currentMeta, final UnsignedLong subtreeVersion) {
             UnsignedLong nodeVersion = subtreeVersion;
-            if (currentMeta.isPresent()) {
-                nodeVersion = StoreUtils.increase(currentMeta.get().getNodeVersion());
-            }
-
             return StoreMetadataNode.builder().setNodeVersion(nodeVersion).setSubtreeVersion(subtreeVersion)
                     .setData(modification.getWritenValue()).build();
         }
@@ -314,6 +335,13 @@ public abstract class SchemaAwareApplyOperation implements ModificationApplyOper
 
         }
 
+        @Override
+        protected StoreMetadataNode applyMerge(final NodeModification modification, final StoreMetadataNode currentMeta,
+                final UnsignedLong subtreeVersion) {
+            // For Node Containers - merge is same as subtree change - we only replace children.
+            return applySubtreeChange(modification, currentMeta, subtreeVersion);
+        }
+
         @Override
         public StoreMetadataNode applySubtreeChange(final NodeModification modification,
                 final StoreMetadataNode currentMeta, final UnsignedLong subtreeVersion) {
@@ -569,7 +597,11 @@ public abstract class SchemaAwareApplyOperation implements ModificationApplyOper
             entryStrategy = Optional.<ModificationApplyOperation> of(new UnkeyedListItemModificationStrategy(schema));
         }
 
-
+        @Override
+        protected StoreMetadataNode applyMerge(final NodeModification modification, final StoreMetadataNode currentMeta,
+                final UnsignedLong subtreeVersion) {
+            return applyWrite(modification, Optional.of(currentMeta), subtreeVersion);
+        }
 
         @Override
         protected StoreMetadataNode applySubtreeChange(final NodeModification modification,
index 04fb3b7..4f650c1 100644 (file)
@@ -20,7 +20,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Predicate;
-import com.google.common.primitives.UnsignedLong;
 
 /**
  * Node Modification Node and Tree
@@ -37,7 +36,9 @@ public class NodeModification implements StoreTreeNode<NodeModification>, Identi
     public static final Predicate<NodeModification> IS_TERMINAL_PREDICATE = new Predicate<NodeModification>() {
         @Override
         public boolean apply(final NodeModification input) {
-            return input.getModificationType() == ModificationType.WRITE || input.getModificationType() == ModificationType.DELETE;
+            return input.getModificationType() == ModificationType.WRITE //
+                    || input.getModificationType() == ModificationType.DELETE //
+                    || input.getModificationType() == ModificationType.MERGE;
         }
     };
     private final PathArgument identifier;
@@ -48,7 +49,6 @@ public class NodeModification implements StoreTreeNode<NodeModification>, Identi
 
     private NormalizedNode<?, ?> value;
 
-    private UnsignedLong subtreeVersion;
     private Optional<StoreMetadataNode> snapshotCache;
 
     private final Map<PathArgument, NodeModification> childModification;
@@ -176,6 +176,14 @@ public class NodeModification implements StoreTreeNode<NodeModification>, Identi
         this.value = value;
     }
 
+    public synchronized void merge(final NormalizedNode<?, ?> data) {
+        checkSealed();
+        clearSnapshot();
+        updateModificationType(ModificationType.MERGE);
+        // FIXME: Probably merge with previous value.
+        this.value = data;
+    }
+
     @GuardedBy("this")
     private void checkSealed() {
         checkState(!sealed, "Node Modification is sealed. No further changes allowed.");
index 6761bc1..ddabbc6 100644 (file)
@@ -33,6 +33,25 @@ public interface DOMStoreWriteTransaction extends DOMStoreTransaction {
      */
     void write(InstanceIdentifier path, NormalizedNode<?, ?> data);
 
+    /**
+     * Store a provided data at specified path. This acts as a add / replace
+     * operation, which is to say that whole subtree will be replaced by
+     * specified path.
+     *
+     * If you need add or merge of current object with specified use
+     * {@link #merge(LogicalDatastoreType, Path, Object)}
+     *
+     *
+     * @param path
+     * @param data
+     *            Data object to be written
+     *
+     * @throws IllegalStateException
+     *             if the client code already sealed transaction and invoked
+     *             {@link #ready()}
+     */
+    void merge(InstanceIdentifier path, NormalizedNode<?, ?> data);
+
     /**
      *
      * Deletes data and whole subtree located at provided path.
index 9b70120..27d320f 100644 (file)
       <groupId>${project.groupId}</groupId>
       <artifactId>sal-connector-api</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.eclipse.xtend</groupId>
-      <artifactId>org.eclipse.xtend.lib</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>ietf-netconf-monitoring</artifactId>
         </configuration>
       </plugin>
 
-      <plugin>
-        <groupId>org.eclipse.xtend</groupId>
-        <artifactId>xtend-maven-plugin</artifactId>
-      </plugin>
-
       <plugin>
         <groupId>org.opendaylight.yangtools</groupId>
         <artifactId>yang-maven-plugin</artifactId>
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.java
new file mode 100644 (file)
index 0000000..aa5c6f4
--- /dev/null
@@ -0,0 +1,512 @@
+/*
+ * 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.connect.netconf;
+
+import static com.google.common.base.Preconditions.checkState;
+import static org.opendaylight.controller.sal.connect.netconf.InventoryUtils.INVENTORY_CONNECTED;
+import static org.opendaylight.controller.sal.connect.netconf.InventoryUtils.INVENTORY_ID;
+import static org.opendaylight.controller.sal.connect.netconf.InventoryUtils.INVENTORY_NODE;
+import static org.opendaylight.controller.sal.connect.netconf.InventoryUtils.INVENTORY_PATH;
+import static org.opendaylight.controller.sal.connect.netconf.InventoryUtils.NETCONF_INVENTORY_INITIAL_CAPABILITY;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.CONFIG_SOURCE_RUNNING;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_DATA_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_GET_CONFIG_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_GET_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.toFilterStructure;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.toRpcMessage;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.wrap;
+
+import java.io.InputStream;
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
+import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.md.sal.common.api.data.DataReader;
+import org.opendaylight.controller.netconf.client.NetconfClientDispatcher;
+import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
+import org.opendaylight.controller.sal.core.api.Provider;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
+import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
+import org.opendaylight.protocol.framework.ReconnectStrategy;
+import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl;
+import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.util.repo.AbstractCachingSchemaSourceProvider;
+import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProvider;
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.parser.impl.util.YangSourceContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.Iterables;
+import com.google.common.util.concurrent.ListenableFuture;
+import io.netty.util.concurrent.EventExecutor;
+
+public class NetconfDevice implements Provider, //
+        DataReader<InstanceIdentifier, CompositeNode>, //
+        DataCommitHandler<InstanceIdentifier, CompositeNode>, //
+        RpcImplementation, //
+        AutoCloseable {
+
+    InetSocketAddress socketAddress;
+
+    MountProvisionInstance mountInstance;
+
+    EventExecutor eventExecutor;
+
+    ExecutorService processingExecutor;
+
+    InstanceIdentifier path;
+
+    ReconnectStrategy reconnectStrategy;
+
+    AbstractCachingSchemaSourceProvider<String, InputStream> schemaSourceProvider;
+
+    private NetconfDeviceSchemaContextProvider deviceContextProvider;
+
+    protected Logger logger;
+
+    Registration<DataReader<InstanceIdentifier, CompositeNode>> operReaderReg;
+    Registration<DataReader<InstanceIdentifier, CompositeNode>> confReaderReg;
+    Registration<DataCommitHandler<InstanceIdentifier, CompositeNode>> commitHandlerReg;
+    List<RpcRegistration> rpcReg;
+
+    String name;
+
+    MountProvisionService mountService;
+
+    NetconfClientDispatcher dispatcher;
+
+    static InstanceIdentifier ROOT_PATH = InstanceIdentifier.builder().toInstance();
+
+    SchemaSourceProvider<InputStream> remoteSourceProvider;
+
+    DataBrokerService dataBroker;
+
+    NetconfDeviceListener listener;
+
+    private boolean rollbackSupported;
+
+
+    public NetconfDevice(String name) {
+        this.name = name;
+        this.logger = LoggerFactory.getLogger(NetconfDevice.class + "#" + name);
+        this.path = InstanceIdentifier.builder(INVENTORY_PATH)
+                .nodeWithKey(INVENTORY_NODE, Collections.<QName, Object>singletonMap(INVENTORY_ID, name)).toInstance();
+    }
+
+    public void start() {
+        checkState(dispatcher != null, "Dispatcher must be set.");
+        checkState(schemaSourceProvider != null, "Schema Source Provider must be set.");
+        checkState(eventExecutor != null, "Event executor must be set.");
+
+        listener = new NetconfDeviceListener(this);
+
+        logger.info("Starting NETCONF Client {} for address {}", name, socketAddress);
+
+        dispatcher.createClient(socketAddress, listener, reconnectStrategy);
+    }
+
+    Optional<SchemaContext> getSchemaContext() {
+        if (deviceContextProvider == null) {
+            return Optional.absent();
+        }
+        return deviceContextProvider.currentContext;
+    }
+
+    void bringDown() {
+        if (rpcReg != null) {
+            for (RpcRegistration reg : rpcReg) {
+                reg.close();
+            }
+            rpcReg = null;
+        }
+        closeGracefully(confReaderReg);
+        confReaderReg = null;
+        closeGracefully(operReaderReg);
+        operReaderReg = null;
+        closeGracefully(commitHandlerReg);
+        commitHandlerReg = null;
+
+        updateDeviceState(false, Collections.<QName> emptySet());
+    }
+
+    private void closeGracefully(final AutoCloseable resource) {
+        if (resource != null) {
+            try {
+                resource.close();
+            } catch (Exception e) {
+                logger.warn("Ignoring exception while closing {}", resource, e);
+            }
+        }
+    }
+
+    void bringUp(final SchemaSourceProvider<String> delegate, final Set<QName> capabilities, final boolean rollbackSupported) {
+        // This has to be called from separate thread, not from netty thread calling onSessionUp in DeviceListener.
+        // Reason: delegate.getSchema blocks thread when waiting for response
+        // however, if the netty thread is blocked, no incoming message can be processed
+        // ... netty should pick another thread from pool to process incoming message, but it does not http://netty.io/wiki/thread-model.html
+        // TODO redesign +refactor
+        processingExecutor.submit(new Runnable() {
+            @Override
+            public void run() {
+                NetconfDevice.this.rollbackSupported = rollbackSupported;
+                remoteSourceProvider = schemaSourceProvider.createInstanceFor(delegate);
+                deviceContextProvider = new NetconfDeviceSchemaContextProvider(NetconfDevice.this, remoteSourceProvider);
+                deviceContextProvider.createContextFromCapabilities(capabilities);
+                if (mountInstance != null && getSchemaContext().isPresent()) {
+                    mountInstance.setSchemaContext(getSchemaContext().get());
+                }
+
+                updateDeviceState(true, capabilities);
+
+                if (mountInstance != null) {
+                    confReaderReg = mountInstance.registerConfigurationReader(ROOT_PATH, NetconfDevice.this);
+                    operReaderReg = mountInstance.registerOperationalReader(ROOT_PATH, NetconfDevice.this);
+                    commitHandlerReg = mountInstance.registerCommitHandler(ROOT_PATH, NetconfDevice.this);
+
+                    List<RpcRegistration> rpcs = new ArrayList<>();
+                    // TODO same condition twice
+                    if (mountInstance != null && getSchemaContext().isPresent()) {
+                        for (RpcDefinition rpc : mountInstance.getSchemaContext().getOperations()) {
+                            rpcs.add(mountInstance.addRpcImplementation(rpc.getQName(), NetconfDevice.this));
+                        }
+                    }
+                    rpcReg = rpcs;
+                }
+            }
+        });
+    }
+
+    private void updateDeviceState(boolean up, Set<QName> capabilities) {
+        DataModificationTransaction transaction = dataBroker.beginTransaction();
+
+        CompositeNodeBuilder<ImmutableCompositeNode> it = ImmutableCompositeNode.builder();
+        it.setQName(INVENTORY_NODE);
+        it.addLeaf(INVENTORY_ID, name);
+        it.addLeaf(INVENTORY_CONNECTED, up);
+
+        logger.debug("Client capabilities {}", capabilities);
+        for (QName capability : capabilities) {
+            it.addLeaf(NETCONF_INVENTORY_INITIAL_CAPABILITY, capability);
+        }
+
+        logger.debug("Update device state transaction " + transaction.getIdentifier()
+                + " putting operational data started.");
+        transaction.removeOperationalData(path);
+        transaction.putOperationalData(path, it.toInstance());
+        logger.debug("Update device state transaction " + transaction.getIdentifier()
+                + " putting operational data ended.");
+
+        // FIXME: this has to be asynchronous
+        RpcResult<TransactionStatus> transactionStatus = null;
+        try {
+            transactionStatus = transaction.commit().get();
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Interrupted while waiting for response", e);
+        } catch (ExecutionException e) {
+            throw new RuntimeException("Read configuration data " + path + " failed", e);
+        }
+        // TODO better ex handling
+
+        if (transactionStatus.isSuccessful()) {
+            logger.debug("Update device state transaction " + transaction.getIdentifier() + " SUCCESSFUL.");
+        } else {
+            logger.debug("Update device state transaction " + transaction.getIdentifier() + " FAILED!");
+            logger.debug("Update device state transaction status " + transaction.getStatus());
+        }
+    }
+
+    @Override
+    public CompositeNode readConfigurationData(InstanceIdentifier path) {
+        RpcResult<CompositeNode> result = null;
+        try {
+            result = this.invokeRpc(NETCONF_GET_CONFIG_QNAME,
+                    wrap(NETCONF_GET_CONFIG_QNAME, CONFIG_SOURCE_RUNNING, toFilterStructure(path))).get();
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Interrupted while waiting for response", e);
+        } catch (ExecutionException e) {
+            throw new RuntimeException("Read configuration data " + path + " failed", e);
+        }
+
+        CompositeNode data = result.getResult().getFirstCompositeByName(NETCONF_DATA_QNAME);
+        return data == null ? null : (CompositeNode) findNode(data, path);
+    }
+
+    @Override
+    public CompositeNode readOperationalData(InstanceIdentifier path) {
+        RpcResult<CompositeNode> result = null;
+        try {
+            result = invokeRpc(NETCONF_GET_QNAME, wrap(NETCONF_GET_QNAME, toFilterStructure(path))).get();
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Interrupted while waiting for response", e);
+        } catch (ExecutionException e) {
+            throw new RuntimeException("Read configuration data " + path + " failed", e);
+        }
+
+        CompositeNode data = result.getResult().getFirstCompositeByName(NETCONF_DATA_QNAME);
+        return (CompositeNode) findNode(data, path);
+    }
+
+    @Override
+    public Set<QName> getSupportedRpcs() {
+        return Collections.emptySet();
+    }
+
+    @Override
+    public ListenableFuture<RpcResult<CompositeNode>> invokeRpc(QName rpc, CompositeNode input) {
+        return listener.sendRequest(toRpcMessage(rpc, input, getSchemaContext()), rpc);
+    }
+
+    @Override
+    public Collection<ProviderFunctionality> getProviderFunctionality() {
+        return Collections.emptySet();
+    }
+
+    @Override
+    public void onSessionInitiated(ProviderSession session) {
+        dataBroker = session.getService(DataBrokerService.class);
+
+        DataModificationTransaction transaction = dataBroker.beginTransaction();
+        if (operationalNodeNotExisting(transaction)) {
+            transaction.putOperationalData(path, getNodeWithId());
+        }
+        if (configurationNodeNotExisting(transaction)) {
+            transaction.putConfigurationData(path, getNodeWithId());
+        }
+
+        try {
+            transaction.commit().get();
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Interrupted while waiting for response", e);
+        } catch (ExecutionException e) {
+            throw new RuntimeException("Read configuration data " + path + " failed", e);
+        }
+
+        mountService = session.getService(MountProvisionService.class);
+        if (mountService != null) {
+            mountInstance = mountService.createOrGetMountPoint(path);
+        }
+    }
+
+    CompositeNode getNodeWithId() {
+        SimpleNodeTOImpl id = new SimpleNodeTOImpl(INVENTORY_ID, null, name);
+        return new CompositeNodeTOImpl(INVENTORY_NODE, null, Collections.<Node<?>> singletonList(id));
+    }
+
+    boolean configurationNodeNotExisting(DataModificationTransaction transaction) {
+        return null == transaction.readConfigurationData(path);
+    }
+
+    boolean operationalNodeNotExisting(DataModificationTransaction transaction) {
+        return null == transaction.readOperationalData(path);
+    }
+
+    static Node<?> findNode(CompositeNode node, InstanceIdentifier identifier) {
+
+        Node<?> current = node;
+        for (InstanceIdentifier.PathArgument arg : identifier.getPath()) {
+            if (current instanceof SimpleNode<?>) {
+                return null;
+            } else if (current instanceof CompositeNode) {
+                CompositeNode currentComposite = (CompositeNode) current;
+
+                current = currentComposite.getFirstCompositeByName(arg.getNodeType());
+                if (current == null) {
+                    current = currentComposite.getFirstCompositeByName(arg.getNodeType().withoutRevision());
+                }
+                if (current == null) {
+                    current = currentComposite.getFirstSimpleByName(arg.getNodeType());
+                }
+                if (current == null) {
+                    current = currentComposite.getFirstSimpleByName(arg.getNodeType().withoutRevision());
+                }
+                if (current == null) {
+                    return null;
+                }
+            }
+        }
+        return current;
+    }
+
+    @Override
+    public DataCommitTransaction<InstanceIdentifier, CompositeNode> requestCommit(
+            DataModification<InstanceIdentifier, CompositeNode> modification) {
+        NetconfDeviceTwoPhaseCommitTransaction twoPhaseCommit = new NetconfDeviceTwoPhaseCommitTransaction(this,
+                modification, true, rollbackSupported);
+        try {
+            twoPhaseCommit.prepare();
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Interrupted while waiting for response", e);
+        } catch (ExecutionException e) {
+            throw new RuntimeException("Read configuration data " + path + " failed", e);
+        }
+         return twoPhaseCommit;
+    }
+
+    Set<QName> getCapabilities(Collection<String> capabilities) {
+        return FluentIterable.from(capabilities).filter(new Predicate<String>() {
+            @Override
+            public boolean apply(final String capability) {
+                return capability.contains("?") && capability.contains("module=") && capability.contains("revision=");
+            }
+        }).transform(new Function<String, QName>() {
+            @Override
+            public QName apply(final String capability) {
+                String[] parts = capability.split("\\?");
+                String namespace = parts[0];
+                FluentIterable<String> queryParams = FluentIterable.from(Arrays.asList(parts[1].split("&")));
+
+                String revision = getStringAndTransform(queryParams, "revision=", "revision=");
+
+                String moduleName = getStringAndTransform(queryParams, "module=", "module=");
+
+                if (revision == null) {
+                    logger.warn("Netconf device was not reporting revision correctly, trying to get amp;revision=");
+                    revision = getStringAndTransform(queryParams, "amp;revision==", "revision=");
+
+                    if (revision != null) {
+                        logger.warn("Netconf device returned revision incorectly escaped for {}", capability);
+                    }
+                }
+                if (revision == null) {
+                    return QName.create(URI.create(namespace), null, moduleName);
+                }
+                return QName.create(namespace, revision, moduleName);
+            }
+
+            private String getStringAndTransform(final Iterable<String> queryParams, final String match,
+                    final String substringToRemove) {
+                Optional<String> found = Iterables.tryFind(queryParams, new Predicate<String>() {
+                    @Override
+                    public boolean apply(final String input) {
+                        return input.startsWith(match);
+                    }
+                });
+
+                return found.isPresent() ? found.get().replaceAll(substringToRemove, "") : null;
+            }
+
+        }).toSet();
+    }
+
+    @Override
+    public void close() {
+        bringDown();
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public InetSocketAddress getSocketAddress() {
+        return socketAddress;
+    }
+
+    public MountProvisionInstance getMountInstance() {
+        return mountInstance;
+    }
+
+    public void setReconnectStrategy(final ReconnectStrategy reconnectStrategy) {
+        this.reconnectStrategy = reconnectStrategy;
+    }
+
+    public void setProcessingExecutor(final ExecutorService processingExecutor) {
+        this.processingExecutor = processingExecutor;
+    }
+
+    public void setSocketAddress(final InetSocketAddress socketAddress) {
+        this.socketAddress = socketAddress;
+    }
+
+    public void setEventExecutor(final EventExecutor eventExecutor) {
+        this.eventExecutor = eventExecutor;
+    }
+
+    public void setSchemaSourceProvider(final AbstractCachingSchemaSourceProvider<String, InputStream> schemaSourceProvider) {
+        this.schemaSourceProvider = schemaSourceProvider;
+    }
+
+    public void setDispatcher(final NetconfClientDispatcher dispatcher) {
+        this.dispatcher = dispatcher;
+    }
+}
+
+class NetconfDeviceSchemaContextProvider {
+
+    NetconfDevice device;
+
+    SchemaSourceProvider<InputStream> sourceProvider;
+
+    Optional<SchemaContext> currentContext;
+
+    NetconfDeviceSchemaContextProvider(NetconfDevice device, SchemaSourceProvider<InputStream> sourceProvider) {
+        this.device = device;
+        this.sourceProvider = sourceProvider;
+        this.currentContext = Optional.absent();
+    }
+
+    void createContextFromCapabilities(Iterable<QName> capabilities) {
+        YangSourceContext sourceContext = YangSourceContext.createFrom(capabilities, sourceProvider);
+        if (!sourceContext.getMissingSources().isEmpty()) {
+            device.logger.warn("Sources for following models are missing {}", sourceContext.getMissingSources());
+        }
+        device.logger.debug("Trying to create schema context from {}", sourceContext.getValidSources());
+        List<InputStream> modelsToParse = YangSourceContext.getValidInputStreams(sourceContext);
+        if (!sourceContext.getValidSources().isEmpty()) {
+            SchemaContext schemaContext = tryToCreateContext(modelsToParse);
+            currentContext = Optional.fromNullable(schemaContext);
+        } else {
+            currentContext = Optional.absent();
+        }
+        if (currentContext.isPresent()) {
+            device.logger.debug("Schema context successfully created.");
+        }
+    }
+
+    SchemaContext tryToCreateContext(List<InputStream> modelsToParse) {
+        YangParserImpl parser = new YangParserImpl();
+        try {
+
+            Set<Module> models = parser.parseYangModelsFromStreams(modelsToParse);
+            return parser.resolveSchemaContext(models);
+        } catch (Exception e) {
+            device.logger.debug("Error occured during parsing YANG schemas", e);
+            return null;
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.xtend b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.xtend
deleted file mode 100644 (file)
index 0b88c66..0000000
+++ /dev/null
@@ -1,368 +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.connect.netconf
-
-import com.google.common.base.Optional
-import com.google.common.collect.FluentIterable
-import io.netty.util.concurrent.EventExecutor
-import java.io.InputStream
-import java.net.InetSocketAddress
-import java.net.URI
-import java.util.ArrayList
-import java.util.Collection
-import java.util.Collections
-import java.util.List
-import java.util.Set
-import java.util.concurrent.ExecutorService
-import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
-import org.opendaylight.controller.md.sal.common.api.data.DataModification
-import org.opendaylight.controller.md.sal.common.api.data.DataReader
-import org.opendaylight.controller.netconf.client.NetconfClientDispatcher
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession
-import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration
-import org.opendaylight.controller.sal.core.api.Provider
-import org.opendaylight.controller.sal.core.api.RpcImplementation
-import org.opendaylight.controller.sal.core.api.data.DataBrokerService
-import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionService
-import org.opendaylight.protocol.framework.ReconnectStrategy
-import org.opendaylight.yangtools.concepts.Registration
-import org.opendaylight.yangtools.yang.common.QName
-import org.opendaylight.yangtools.yang.data.api.CompositeNode
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
-import org.opendaylight.yangtools.yang.data.api.Node
-import org.opendaylight.yangtools.yang.data.api.SimpleNode
-import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl
-import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode
-import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl
-import org.opendaylight.yangtools.yang.model.api.SchemaContext
-import org.opendaylight.yangtools.yang.model.util.repo.AbstractCachingSchemaSourceProvider
-import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProvider
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl
-import org.opendaylight.yangtools.yang.parser.impl.util.YangSourceContext
-import org.slf4j.Logger
-import org.slf4j.LoggerFactory
-
-import static com.google.common.base.Preconditions.*
-import static org.opendaylight.controller.sal.connect.netconf.InventoryUtils.*
-
-import static extension org.opendaylight.controller.sal.connect.netconf.NetconfMapping.*
-
-class NetconfDevice implements Provider, //
-DataReader<InstanceIdentifier, CompositeNode>, //
-DataCommitHandler<InstanceIdentifier, CompositeNode>, //
-RpcImplementation, //
-AutoCloseable {
-
-    @Property
-    var InetSocketAddress socketAddress;
-
-    @Property
-    var MountProvisionInstance mountInstance;
-
-    @Property
-    var EventExecutor eventExecutor;
-
-    @Property
-    var ExecutorService processingExecutor;
-
-    @Property
-    var InstanceIdentifier path;
-
-    @Property
-    var ReconnectStrategy reconnectStrategy;
-
-    @Property
-    var AbstractCachingSchemaSourceProvider<String, InputStream> schemaSourceProvider;
-
-    @Property
-    private NetconfDeviceSchemaContextProvider deviceContextProvider
-
-    protected val Logger logger
-
-    Registration<DataReader<InstanceIdentifier, CompositeNode>> operReaderReg
-    Registration<DataReader<InstanceIdentifier, CompositeNode>> confReaderReg
-    Registration<DataCommitHandler<InstanceIdentifier, CompositeNode>> commitHandlerReg
-    List<RpcRegistration> rpcReg
-
-    @Property
-    val String name
-
-    MountProvisionService mountService
-
-    @Property
-    var NetconfClientDispatcher dispatcher
-
-    static val InstanceIdentifier ROOT_PATH = InstanceIdentifier.builder().toInstance();
-
-    @Property
-    var SchemaSourceProvider<InputStream> remoteSourceProvider
-
-    DataBrokerService dataBroker
-
-    var NetconfDeviceListener listener;
-
-    public new(String name) {
-        this._name = name;
-        this.logger = LoggerFactory.getLogger(NetconfDevice.name + "#" + name);
-        this.path = InstanceIdentifier.builder(INVENTORY_PATH).nodeWithKey(INVENTORY_NODE,
-            Collections.singletonMap(INVENTORY_ID, name)).toInstance;
-    }
-
-    def start() {
-        checkState(dispatcher != null, "Dispatcher must be set.");
-        checkState(schemaSourceProvider != null, "Schema Source Provider must be set.")
-        checkState(eventExecutor != null, "Event executor must be set.");
-
-        listener = new NetconfDeviceListener(this);
-
-        logger.info("Starting NETCONF Client {} for address {}", name, socketAddress);
-
-        dispatcher.createClient(socketAddress, listener, reconnectStrategy);
-    }
-
-    def Optional<SchemaContext> getSchemaContext() {
-        if (deviceContextProvider == null) {
-            return Optional.absent();
-        }
-        return deviceContextProvider.currentContext;
-    }
-
-    def bringDown() {
-        if (rpcReg != null) {
-            for (reg : rpcReg) {
-                reg.close()
-            }
-            rpcReg = null
-        }
-        confReaderReg?.close()
-        confReaderReg = null
-        operReaderReg?.close()
-        operReaderReg = null
-        commitHandlerReg?.close()
-        commitHandlerReg = null
-
-        updateDeviceState(false, Collections.emptySet())
-    }
-
-    def bringUp(SchemaSourceProvider<String> delegate, Set<QName> capabilities) {
-        remoteSourceProvider = schemaSourceProvider.createInstanceFor(delegate);
-        deviceContextProvider = new NetconfDeviceSchemaContextProvider(this, remoteSourceProvider);
-        deviceContextProvider.createContextFromCapabilities(capabilities);
-        if (mountInstance != null && schemaContext.isPresent) {
-            mountInstance.schemaContext = schemaContext.get();
-        }
-
-        updateDeviceState(true, capabilities)
-
-        if (mountInstance != null) {
-            confReaderReg = mountInstance.registerConfigurationReader(ROOT_PATH, this);
-            operReaderReg = mountInstance.registerOperationalReader(ROOT_PATH, this);
-            commitHandlerReg = mountInstance.registerCommitHandler(ROOT_PATH, this);
-
-            val rpcs = new ArrayList<RpcRegistration>();
-            if (mountInstance != null && schemaContext.isPresent) {
-                for (rpc : mountInstance.schemaContext.operations) {
-                    rpcs.add(mountInstance.addRpcImplementation(rpc.QName, this));
-                }
-            }
-            rpcReg = rpcs
-        }
-    }
-
-    private def updateDeviceState(boolean up, Set<QName> capabilities) {
-        val transaction = dataBroker.beginTransaction
-
-        val it = ImmutableCompositeNode.builder
-        setQName(INVENTORY_NODE)
-        addLeaf(INVENTORY_ID, name)
-        addLeaf(INVENTORY_CONNECTED, up)
-
-        logger.debug("Client capabilities {}", capabilities)
-        for (capability : capabilities) {
-            addLeaf(NETCONF_INVENTORY_INITIAL_CAPABILITY, capability)
-        }
-
-        logger.debug("Update device state transaction " + transaction.identifier + " putting operational data started.")
-        transaction.removeOperationalData(path)
-        transaction.putOperationalData(path, it.toInstance)
-        logger.debug("Update device state transaction " + transaction.identifier + " putting operational data ended.")
-
-        // FIXME: this has to be asynchronous
-        val transactionStatus = transaction.commit.get;
-
-        if (transactionStatus.successful) {
-            logger.debug("Update device state transaction " + transaction.identifier + " SUCCESSFUL.")
-        } else {
-            logger.debug("Update device state transaction " + transaction.identifier + " FAILED!")
-            logger.debug("Update device state transaction status " + transaction.status)
-        }
-    }
-
-    override readConfigurationData(InstanceIdentifier path) {
-        val result = invokeRpc(NETCONF_GET_CONFIG_QNAME,
-            wrap(NETCONF_GET_CONFIG_QNAME, CONFIG_SOURCE_RUNNING, path.toFilterStructure())).get();
-        val data = result.result.getFirstCompositeByName(NETCONF_DATA_QNAME);
-        return data?.findNode(path) as CompositeNode;
-    }
-
-    override readOperationalData(InstanceIdentifier path) {
-        val result = invokeRpc(NETCONF_GET_QNAME, wrap(NETCONF_GET_QNAME, path.toFilterStructure())).get();
-        val data = result.result.getFirstCompositeByName(NETCONF_DATA_QNAME);
-        return data?.findNode(path) as CompositeNode;
-    }
-
-    override getSupportedRpcs() {
-        Collections.emptySet;
-    }
-
-    override invokeRpc(QName rpc, CompositeNode input) {
-        return listener.sendRequest(rpc.toRpcMessage(input,schemaContext));
-    }
-
-    override getProviderFunctionality() {
-        Collections.emptySet
-    }
-
-    override onSessionInitiated(ProviderSession session) {
-        dataBroker = session.getService(DataBrokerService);
-
-        val transaction = dataBroker.beginTransaction
-        if (transaction.operationalNodeNotExisting) {
-            transaction.putOperationalData(path, nodeWithId)
-        }
-        if (transaction.configurationNodeNotExisting) {
-            transaction.putConfigurationData(path, nodeWithId)
-        }
-        transaction.commit().get();
-        mountService = session.getService(MountProvisionService);
-        mountInstance = mountService?.createOrGetMountPoint(path);
-    }
-
-    def getNodeWithId() {
-        val id = new SimpleNodeTOImpl(INVENTORY_ID, null, name);
-        return new CompositeNodeTOImpl(INVENTORY_NODE, null, Collections.singletonList(id));
-    }
-
-    def boolean configurationNodeNotExisting(DataModificationTransaction transaction) {
-        return null === transaction.readConfigurationData(path);
-    }
-
-    def boolean operationalNodeNotExisting(DataModificationTransaction transaction) {
-        return null === transaction.readOperationalData(path);
-    }
-
-    static def Node<?> findNode(CompositeNode node, InstanceIdentifier identifier) {
-
-        var Node<?> current = node;
-        for (arg : identifier.path) {
-            if (current instanceof SimpleNode<?>) {
-                return null;
-            } else if (current instanceof CompositeNode) {
-                val currentComposite = (current as CompositeNode);
-
-                current = currentComposite.getFirstCompositeByName(arg.nodeType);
-                if(current == null) {
-                    current = currentComposite.getFirstCompositeByName(arg.nodeType.withoutRevision());
-                }
-                if(current == null) {
-                    current = currentComposite.getFirstSimpleByName(arg.nodeType);
-                }
-                if (current == null) {
-                    current = currentComposite.getFirstSimpleByName(arg.nodeType.withoutRevision());
-                } if (current == null) {
-                    return null;
-                }
-            }
-        }
-        return current;
-    }
-
-    override requestCommit(DataModification<InstanceIdentifier, CompositeNode> modification) {
-        val twoPhaseCommit = new NetconfDeviceTwoPhaseCommitTransaction(this, modification, true);
-        twoPhaseCommit.prepare()
-        return twoPhaseCommit;
-    }
-
-    def getCapabilities(Collection<String> capabilities) {
-        return FluentIterable.from(capabilities).filter[
-                contains("?") && contains("module=") && contains("revision=")].transform [
-                val parts = split("\\?");
-                val namespace = parts.get(0);
-                val queryParams = FluentIterable.from(parts.get(1).split("&"));
-                var revision = queryParams.findFirst[startsWith("revision=")]?.replaceAll("revision=", "");
-                val moduleName = queryParams.findFirst[startsWith("module=")]?.replaceAll("module=", "");
-                if (revision === null) {
-                    logger.warn("Netconf device was not reporting revision correctly, trying to get amp;revision=");
-                    revision = queryParams.findFirst[startsWith("&amp;revision=")]?.replaceAll("revision=", "");
-                    if (revision != null) {
-                        logger.warn("Netconf device returned revision incorectly escaped for {}", it)
-                    }
-                }
-                if (revision == null) {
-                    return QName.create(URI.create(namespace), null, moduleName);
-                }
-                return QName.create(namespace, revision, moduleName);
-            ].toSet();
-    }
-
-    override close() {
-        bringDown()
-    }
-}
-
-package class NetconfDeviceSchemaContextProvider {
-
-    @Property
-    val NetconfDevice device;
-
-    @Property
-    val SchemaSourceProvider<InputStream> sourceProvider;
-
-    @Property
-    var Optional<SchemaContext> currentContext;
-
-    new(NetconfDevice device, SchemaSourceProvider<InputStream> sourceProvider) {
-        _device = device
-        _sourceProvider = sourceProvider
-        _currentContext = Optional.absent();
-    }
-
-    def createContextFromCapabilities(Iterable<QName> capabilities) {
-        val sourceContext = YangSourceContext.createFrom(capabilities, sourceProvider)
-        if (!sourceContext.missingSources.empty) {
-            device.logger.warn("Sources for following models are missing {}", sourceContext.missingSources);
-        }
-        device.logger.debug("Trying to create schema context from {}", sourceContext.validSources)
-        val modelsToParse = YangSourceContext.getValidInputStreams(sourceContext);
-        if (!sourceContext.validSources.empty) {
-            val schemaContext = tryToCreateContext(modelsToParse);
-            currentContext = Optional.fromNullable(schemaContext);
-        } else {
-            currentContext = Optional.absent();
-        }
-        if (currentContext.present) {
-            device.logger.debug("Schema context successfully created.");
-        }
-
-    }
-
-    def SchemaContext tryToCreateContext(List<InputStream> modelsToParse) {
-        val parser = new YangParserImpl();
-        try {
-
-            val models = parser.parseYangModelsFromStreams(modelsToParse);
-            val result = parser.resolveSchemaContext(models);
-            return result;
-        } catch (Exception e) {
-            device.logger.debug("Error occured during parsing YANG schemas", e);
-            return null;
-        }
-    }
-}
index 8c65aa3..1dfc3b4 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.controller.sal.connect.netconf;
 
+import com.google.common.collect.Sets;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.FutureListener;
 
@@ -17,12 +18,14 @@ import java.util.Iterator;
 import java.util.Queue;
 import java.util.Set;
 
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.NetconfTerminationReason;
 import org.opendaylight.controller.netconf.client.NetconfClientSession;
 import org.opendaylight.controller.netconf.client.NetconfClientSessionListener;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.opendaylight.controller.sal.common.util.Rpcs;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -39,13 +42,16 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 
 class NetconfDeviceListener implements NetconfClientSessionListener {
+
     private static final class Request {
         final UncancellableFuture<RpcResult<CompositeNode>> future;
         final NetconfMessage request;
+        final QName rpc;
 
-        private Request(UncancellableFuture<RpcResult<CompositeNode>> future, NetconfMessage request) {
+        private Request(UncancellableFuture<RpcResult<CompositeNode>> future, NetconfMessage request, final QName rpc) {
             this.future = future;
             this.request = request;
+            this.rpc = rpc;
         }
     }
 
@@ -64,6 +70,7 @@ class NetconfDeviceListener implements NetconfClientSessionListener {
                 device.getName(), device.getSocketAddress(), session.getSessionId());
 
         this.session = session;
+
         final Set<QName> caps = device.getCapabilities(session.getServerCapabilities());
         LOG.trace("Server {} advertized capabilities {}", device.getName(), caps);
 
@@ -71,18 +78,24 @@ class NetconfDeviceListener implements NetconfClientSessionListener {
         final SchemaSourceProvider<String> delegate;
         if (NetconfRemoteSchemaSourceProvider.isSupportedFor(caps)) {
             delegate = new NetconfRemoteSchemaSourceProvider(device);
-            // FIXME parsed caps contain only module-based capabilities
+            // FIXME caps do not contain urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring, since it is filtered out in getCapabilitites
         } else if(session.getServerCapabilities().contains(NetconfRemoteSchemaSourceProvider.IETF_NETCONF_MONITORING.getNamespace().toString())) {
             delegate = new NetconfRemoteSchemaSourceProvider(device);
         } else {
             LOG.info("Netconf server {} does not support IETF Netconf Monitoring", device.getName());
-            delegate = SchemaSourceProviders.<String>noopProvider();
+            delegate = SchemaSourceProviders.noopProvider();
         }
 
-        device.bringUp(delegate, caps);
+        device.bringUp(delegate, caps, isRollbackSupported(session.getServerCapabilities()));
 
     }
 
+    private static boolean isRollbackSupported(final Collection<String> serverCapabilities) {
+        // TODO rollback capability cannot be searched for in Set<QName> caps
+        // since this set does not contain module-less capabilities
+        return Sets.newHashSet(serverCapabilities).contains(NetconfMapping.NETCONF_ROLLBACK_ON_ERROR_URI.toString());
+    }
+
     private synchronized void tearDown(final Exception e) {
         session = null;
 
@@ -137,17 +150,29 @@ class NetconfDeviceListener implements NetconfClientSessionListener {
             requests.poll();
             LOG.debug("Matched {} to {}", r.request, message);
 
-            // FIXME: this can throw exceptions, which should result
-            // in the future failing
-            NetconfMapping.checkValidReply(r.request, message);
-            r.future.set(Rpcs.getRpcResult(true, NetconfMapping.toNotificationNode(message, device.getSchemaContext()),
-                    Collections.<RpcError>emptyList()));
+            try {
+                NetconfMapping.checkValidReply(r.request, message);
+            } catch (IllegalStateException e) {
+                LOG.warn("Invalid request-reply match, reply message contains different message-id", e);
+                r.future.setException(e);
+                return;
+            }
+
+            try {
+                NetconfMapping.checkSuccessReply(message);
+            } catch (NetconfDocumentedException | IllegalStateException e) {
+                LOG.warn("Error reply from remote device", e);
+                r.future.setException(e);
+                return;
+            }
+
+            r.future.set(NetconfMapping.toRpcResult(message, r.rpc, device.getSchemaContext()));
         } else {
             LOG.warn("Ignoring unsolicited message", message);
         }
     }
 
-    synchronized ListenableFuture<RpcResult<CompositeNode>> sendRequest(final NetconfMessage message) {
+    synchronized ListenableFuture<RpcResult<CompositeNode>> sendRequest(final NetconfMessage message, final QName rpc) {
         if (session == null) {
             LOG.debug("Session to {} is disconnected, failing RPC request {}", device.getName(), message);
             return Futures.<RpcResult<CompositeNode>>immediateFuture(new RpcResult<CompositeNode>() {
@@ -169,7 +194,7 @@ class NetconfDeviceListener implements NetconfClientSessionListener {
             });
         }
 
-        final Request req = new Request(new UncancellableFuture<RpcResult<CompositeNode>>(true), message);
+        final Request req = new Request(new UncancellableFuture<RpcResult<CompositeNode>>(true), message, rpc);
         requests.add(req);
 
         session.sendMessage(req.request).addListener(new FutureListener<Void>() {
@@ -177,7 +202,7 @@ class NetconfDeviceListener implements NetconfClientSessionListener {
             public void operationComplete(final Future<Void> future) throws Exception {
                 if (!future.isSuccess()) {
                     // We expect that a session down will occur at this point
-                    LOG.debug("Failed to send request {}", req.request, future.cause());
+                    LOG.debug("Failed to send request {}", XmlUtil.toString(req.request.getDocument()), future.cause());
                     req.future.setException(future.cause());
                 } else {
                     LOG.trace("Finished sending request {}", req.request);
index 5f14c26..8a74b17 100644 (file)
@@ -11,9 +11,11 @@ import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NET
 import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_COMMIT_QNAME;
 import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_CONFIG_QNAME;
 import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_EDIT_CONFIG_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_ERROR_OPTION_QNAME;
 import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_OPERATION_QNAME;
 import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_RUNNING_QNAME;
 import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_TARGET_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.ROLLBACK_ON_ERROR_OPTION;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -33,6 +35,7 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifie
 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.Node;
 import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl;
 import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -47,13 +50,15 @@ class NetconfDeviceTwoPhaseCommitTransaction implements DataCommitTransaction<In
     private final DataModification<InstanceIdentifier, CompositeNode> modification;
     private final NetconfDevice device;
     private final boolean candidateSupported;
+    private final boolean rollbackSupported;
 
     public NetconfDeviceTwoPhaseCommitTransaction(NetconfDevice device,
             DataModification<InstanceIdentifier, CompositeNode> modification,
-            boolean candidateSupported) {
+            boolean candidateSupported, boolean rollbackOnErrorSupported) {
         this.device = Preconditions.checkNotNull(device);
         this.modification = Preconditions.checkNotNull(modification);
         this.candidateSupported = candidateSupported;
+        this.rollbackSupported = rollbackOnErrorSupported;
     }
 
     void prepare() throws InterruptedException, ExecutionException {
@@ -91,7 +96,14 @@ class NetconfDeviceTwoPhaseCommitTransaction implements DataCommitTransaction<In
         } else {
             targetNode = ImmutableCompositeNode.create(NETCONF_RUNNING_QNAME, ImmutableList.<Node<?>>of());
         }
+
         Node<?> targetWrapperNode = ImmutableCompositeNode.create(NETCONF_TARGET_QNAME, ImmutableList.<Node<?>>of(targetNode));
+
+        if(rollbackSupported) {
+            LOG.debug("Rollback-on-error supported, setting {} to {}", NETCONF_ERROR_OPTION_QNAME, ROLLBACK_ON_ERROR_OPTION);
+            ret.addLeaf(NETCONF_ERROR_OPTION_QNAME, ROLLBACK_ON_ERROR_OPTION);
+        }
+
         ret.add(targetWrapperNode);
         return ret;
     }
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.java
new file mode 100644 (file)
index 0000000..f0b711d
--- /dev/null
@@ -0,0 +1,261 @@
+/*
+ * 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.connect.netconf;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.activation.UnsupportedDataTypeException;
+import javax.annotation.Nullable;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
+import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.util.messages.NetconfMessageUtil;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
+import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl;
+import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils;
+import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
+import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class NetconfMapping {
+
+    public static URI NETCONF_URI = URI.create("urn:ietf:params:xml:ns:netconf:base:1.0");
+    public static String NETCONF_MONITORING_URI = "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring";
+    public static URI NETCONF_NOTIFICATION_URI = URI.create("urn:ietf:params:xml:ns:netconf:notification:1.0");
+    public static URI NETCONF_ROLLBACK_ON_ERROR_URI = URI.create("urn:ietf:params:netconf:capability:rollback-on-error:1.0");
+
+    public static QName NETCONF_QNAME = QName.create(NETCONF_URI, null, "netconf");
+    public static QName NETCONF_RPC_QNAME = QName.create(NETCONF_QNAME, "rpc");
+    public static QName NETCONF_GET_QNAME = QName.create(NETCONF_QNAME, "get");
+    public static QName NETCONF_FILTER_QNAME = QName.create(NETCONF_QNAME, "filter");
+    public static QName NETCONF_TYPE_QNAME = QName.create(NETCONF_QNAME, "type");
+    public static QName NETCONF_GET_CONFIG_QNAME = QName.create(NETCONF_QNAME, "get-config");
+    public static QName NETCONF_EDIT_CONFIG_QNAME = QName.create(NETCONF_QNAME, "edit-config");
+    public static QName NETCONF_DELETE_CONFIG_QNAME = QName.create(NETCONF_QNAME, "delete-config");
+    public static QName NETCONF_OPERATION_QNAME = QName.create(NETCONF_QNAME, "operation");
+    public static QName NETCONF_COMMIT_QNAME = QName.create(NETCONF_QNAME, "commit");
+
+    public static QName NETCONF_CONFIG_QNAME = QName.create(NETCONF_QNAME, "config");
+    public static QName NETCONF_SOURCE_QNAME = QName.create(NETCONF_QNAME, "source");
+    public static QName NETCONF_TARGET_QNAME = QName.create(NETCONF_QNAME, "target");
+
+    public static QName NETCONF_CANDIDATE_QNAME = QName.create(NETCONF_QNAME, "candidate");
+    public static QName NETCONF_RUNNING_QNAME = QName.create(NETCONF_QNAME, "running");
+
+    public static QName NETCONF_ERROR_OPTION_QNAME = QName.create(NETCONF_QNAME, "error-option");
+    public static String ROLLBACK_ON_ERROR_OPTION = "rollback-on-error";
+
+    public static QName NETCONF_RPC_REPLY_QNAME = QName.create(NETCONF_QNAME, "rpc-reply");
+    public static QName NETCONF_OK_QNAME = QName.create(NETCONF_QNAME, "ok");
+    public static QName NETCONF_DATA_QNAME = QName.create(NETCONF_QNAME, "data");
+    public static QName NETCONF_CREATE_SUBSCRIPTION_QNAME = QName.create(NETCONF_NOTIFICATION_URI, null,
+            "create-subscription");
+    public static QName NETCONF_CANCEL_SUBSCRIPTION_QNAME = QName.create(NETCONF_NOTIFICATION_URI, null,
+            "cancel-subscription");
+    public static QName IETF_NETCONF_MONITORING_MODULE = QName.create(NETCONF_MONITORING_URI, "2010-10-04",
+            "ietf-netconf-monitoring");
+
+    static List<Node<?>> RUNNING = Collections.<Node<?>> singletonList(new SimpleNodeTOImpl(NETCONF_RUNNING_QNAME,
+            null, null));
+
+    public static CompositeNode CONFIG_SOURCE_RUNNING = new CompositeNodeTOImpl(NETCONF_SOURCE_QNAME, null, RUNNING);
+
+    static AtomicInteger messageId = new AtomicInteger(0);
+
+    static Node<?> toFilterStructure(InstanceIdentifier identifier) {
+        Node<?> previous = null;
+        if (identifier.getPath().isEmpty()) {
+            return null;
+        }
+
+        for (org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument component : Lists
+                .reverse(identifier.getPath())) {
+            previous = toNode(component, previous);
+        }
+        return filter("subtree", previous);
+    }
+
+    static Node<?> toNode(NodeIdentifierWithPredicates argument, Node<?> node) {
+        List<Node<?>> list = new ArrayList<>();
+        for (Map.Entry<QName, Object> arg : argument.getKeyValues().entrySet()) {
+            list.add(new SimpleNodeTOImpl(arg.getKey(), null, arg.getValue()));
+        }
+        if (node != null) {
+            list.add(node);
+        }
+        return new CompositeNodeTOImpl(argument.getNodeType(), null, list);
+    }
+
+    static Node<?> toNode(PathArgument argument, Node<?> node) {
+        if (node != null) {
+            return new CompositeNodeTOImpl(argument.getNodeType(), null, Collections.<Node<?>> singletonList(node));
+        } else {
+            return new SimpleNodeTOImpl(argument.getNodeType(), null, null);
+        }
+    }
+
+    static CompositeNode toCompositeNode(NetconfMessage message, Optional<SchemaContext> ctx) {
+        // TODO: implement general normalization to normalize incoming Netconf
+        // Message
+        // for Schema Context counterpart
+        return null;
+    }
+
+    static CompositeNode toNotificationNode(NetconfMessage message, Optional<SchemaContext> ctx) {
+        if (ctx.isPresent()) {
+            SchemaContext schemaContext = ctx.get();
+            Set<NotificationDefinition> notifications = schemaContext.getNotifications();
+            Document document = message.getDocument();
+            return XmlDocumentUtils.notificationToDomNodes(document, Optional.fromNullable(notifications));
+        }
+        return null;
+    }
+
+    static NetconfMessage toRpcMessage(QName rpc, CompositeNode node, Optional<SchemaContext> ctx) {
+        CompositeNodeTOImpl rpcPayload = wrap(NETCONF_RPC_QNAME, flattenInput(node));
+        Document w3cPayload = null;
+        try {
+            w3cPayload = XmlDocumentUtils.toDocument(rpcPayload, XmlDocumentUtils.defaultValueCodecProvider());
+        } catch (UnsupportedDataTypeException e) {
+            throw new IllegalArgumentException("Unable to create message", e);
+        }
+        w3cPayload.getDocumentElement().setAttribute("message-id", "m-" + messageId.getAndIncrement());
+        return new NetconfMessage(w3cPayload);
+    }
+
+    static CompositeNode flattenInput(final CompositeNode node) {
+        final QName inputQName = QName.create(node.getNodeType(), "input");
+        CompositeNode input = node.getFirstCompositeByName(inputQName);
+        if (input == null)
+            return node;
+        if (input instanceof CompositeNode) {
+
+            List<Node<?>> nodes = ImmutableList.<Node<?>> builder() //
+                    .addAll(input.getChildren()) //
+                    .addAll(Collections2.filter(node.getChildren(), new Predicate<Node<?>>() {
+                        @Override
+                        public boolean apply(@Nullable final Node<?> input) {
+                            return input.getNodeType() != inputQName;
+                        }
+                    })) //
+                    .build();
+
+            return ImmutableCompositeNode.create(node.getNodeType(), nodes);
+        }
+
+        return input;
+    }
+
+    static RpcResult<CompositeNode> toRpcResult(NetconfMessage message, final QName rpc, Optional<SchemaContext> context) {
+        CompositeNode rawRpc;
+        if (context.isPresent())
+            if (isDataRetrieQNameReply(rpc)) {
+
+                Element xmlData = getDataSubtree(message.getDocument());
+
+                List<org.opendaylight.yangtools.yang.data.api.Node<?>> dataNodes = XmlDocumentUtils.toDomNodes(xmlData,
+                        Optional.of(context.get().getDataDefinitions()));
+
+                CompositeNodeBuilder<ImmutableCompositeNode> it = ImmutableCompositeNode.builder();
+                it.setQName(NETCONF_RPC_REPLY_QNAME);
+                it.add(ImmutableCompositeNode.create(NETCONF_DATA_QNAME, dataNodes));
+
+                rawRpc = it.toInstance();
+                // sys(xmlData)
+            } else {
+                rawRpc = (CompositeNode) toCompositeNode(message.getDocument());
+            }
+        else {
+            rawRpc = (CompositeNode) toCompositeNode(message.getDocument());
+        }
+        // rawRpc.
+        return Rpcs.getRpcResult(true, rawRpc, Collections.<RpcError> emptySet());
+    }
+
+    static Element getDataSubtree(Document doc) {
+        return (Element) doc.getElementsByTagNameNS(NETCONF_URI.toString(), "data").item(0);
+    }
+
+    static boolean isDataRetrieQNameReply(QName it) {
+        return NETCONF_URI == it.getNamespace()
+                && (it.getLocalName() == NETCONF_GET_CONFIG_QNAME.getLocalName() || it.getLocalName() == NETCONF_GET_QNAME
+                        .getLocalName());
+    }
+
+    static CompositeNodeTOImpl wrap(QName name, Node<?> node) {
+        if (node != null) {
+            return new CompositeNodeTOImpl(name, null, Collections.<Node<?>> singletonList(node));
+        } else {
+            return new CompositeNodeTOImpl(name, null, Collections.<Node<?>> emptyList());
+        }
+    }
+
+    static CompositeNodeTOImpl wrap(QName name, Node<?> additional, Node<?> node) {
+        if (node != null) {
+            return new CompositeNodeTOImpl(name, null, ImmutableList.of(additional, node));
+        } else {
+            return new CompositeNodeTOImpl(name, null, ImmutableList.<Node<?>> of(additional));
+        }
+    }
+
+    static ImmutableCompositeNode filter(String type, Node<?> node) {
+        CompositeNodeBuilder<ImmutableCompositeNode> it = ImmutableCompositeNode.builder(); //
+        it.setQName(NETCONF_FILTER_QNAME);
+        it.setAttribute(NETCONF_TYPE_QNAME, type);
+        if (node != null) {
+            return it.add(node).toInstance();
+        } else {
+            return it.toInstance();
+        }
+    }
+
+    public static Node<?> toCompositeNode(Document document) {
+        return XmlDocumentUtils.toDomNode(document);
+    }
+
+    public static void checkValidReply(NetconfMessage input, NetconfMessage output) {
+        String inputMsgId = input.getDocument().getDocumentElement().getAttribute("message-id");
+        String outputMsgId = output.getDocument().getDocumentElement().getAttribute("message-id");
+
+        if(inputMsgId.equals(outputMsgId) == false) {
+            String requestXml = XmlUtil.toString(input.getDocument());
+            String responseXml = XmlUtil.toString(output.getDocument());
+            throw new IllegalStateException(String.format("Rpc request and reply message IDs must be same. Request: %s, response: %s", requestXml, responseXml));
+        }
+    }
+
+    public static void checkSuccessReply(NetconfMessage output) throws NetconfDocumentedException {
+        if(NetconfMessageUtil.isErrorMessage(output)) {
+            throw new IllegalStateException(String.format("Response contains error: %s", XmlUtil.toString(output.getDocument())));
+        }
+    }
+}
diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.xtend b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfMapping.xtend
deleted file mode 100644 (file)
index 228a01e..0000000
+++ /dev/null
@@ -1,217 +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.connect.netconf
-
-import com.google.common.base.Optional
-import com.google.common.base.Preconditions
-import com.google.common.collect.ImmutableList
-import java.net.URI
-import java.util.ArrayList
-import java.util.Collections
-import java.util.List
-import java.util.Set
-import java.util.concurrent.atomic.AtomicInteger
-import org.opendaylight.controller.netconf.api.NetconfMessage
-import org.opendaylight.controller.sal.common.util.Rpcs
-import org.opendaylight.yangtools.yang.common.QName
-import org.opendaylight.yangtools.yang.common.RpcResult
-import org.opendaylight.yangtools.yang.data.api.CompositeNode
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.NodeIdentifierWithPredicates
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument
-import org.opendaylight.yangtools.yang.data.api.Node
-import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl
-import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode
-import org.opendaylight.yangtools.yang.data.impl.SimpleNodeTOImpl
-import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils
-import org.opendaylight.yangtools.yang.model.api.NotificationDefinition
-import org.opendaylight.yangtools.yang.model.api.SchemaContext
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-
-class NetconfMapping {
-
-    public static val NETCONF_URI = URI.create("urn:ietf:params:xml:ns:netconf:base:1.0")
-    public static val NETCONF_MONITORING_URI = "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"
-    public static val NETCONF_NOTIFICATION_URI = URI.create("urn:ietf:params:xml:ns:netconf:notification:1.0")
-
-
-    public static val NETCONF_QNAME = QName.create(NETCONF_URI, null, "netconf");
-    public static val NETCONF_RPC_QNAME = QName.create(NETCONF_QNAME, "rpc");
-    public static val NETCONF_GET_QNAME = QName.create(NETCONF_QNAME, "get");
-    public static val NETCONF_FILTER_QNAME = QName.create(NETCONF_QNAME, "filter");
-    public static val NETCONF_TYPE_QNAME = QName.create(NETCONF_QNAME, "type");
-    public static val NETCONF_GET_CONFIG_QNAME = QName.create(NETCONF_QNAME, "get-config");
-    public static val NETCONF_EDIT_CONFIG_QNAME = QName.create(NETCONF_QNAME, "edit-config");
-    public static val NETCONF_DELETE_CONFIG_QNAME = QName.create(NETCONF_QNAME, "delete-config");
-    public static val NETCONF_OPERATION_QNAME = QName.create(NETCONF_QNAME, "operation");
-    public static val NETCONF_COMMIT_QNAME = QName.create(NETCONF_QNAME, "commit");
-
-    public static val NETCONF_CONFIG_QNAME = QName.create(NETCONF_QNAME, "config");
-    public static val NETCONF_SOURCE_QNAME = QName.create(NETCONF_QNAME, "source");
-    public static val NETCONF_TARGET_QNAME = QName.create(NETCONF_QNAME, "target");
-
-    public static val NETCONF_CANDIDATE_QNAME = QName.create(NETCONF_QNAME, "candidate");
-    public static val NETCONF_RUNNING_QNAME = QName.create(NETCONF_QNAME, "running");
-
-
-    public static val NETCONF_RPC_REPLY_QNAME = QName.create(NETCONF_QNAME, "rpc-reply");
-    public static val NETCONF_OK_QNAME = QName.create(NETCONF_QNAME, "ok");
-    public static val NETCONF_DATA_QNAME = QName.create(NETCONF_QNAME, "data");
-    public static val NETCONF_CREATE_SUBSCRIPTION_QNAME = QName.create(NETCONF_NOTIFICATION_URI,null,"create-subscription");
-    public static val NETCONF_CANCEL_SUBSCRIPTION_QNAME = QName.create(NETCONF_NOTIFICATION_URI,null,"cancel-subscription");
-    public static val IETF_NETCONF_MONITORING_MODULE = QName.create(NETCONF_MONITORING_URI, "2010-10-04","ietf-netconf-monitoring");
-
-    static List<Node<?>> RUNNING = Collections.<Node<?>>singletonList(
-        new SimpleNodeTOImpl(NETCONF_RUNNING_QNAME, null, null));
-    public static val CONFIG_SOURCE_RUNNING = new CompositeNodeTOImpl(NETCONF_SOURCE_QNAME, null, RUNNING);
-
-    static val messageId = new AtomicInteger(0);
-
-    static def Node<?> toFilterStructure(InstanceIdentifier identifier) {
-        var Node<?> previous = null;
-        if(identifier.path.empty) {
-            return null;
-        }
-
-        for (component : identifier.path.reverseView) {
-            val Node<?> current = component.toNode(previous);
-            previous = current;
-        }
-        return filter("subtree",previous);
-    }
-
-    static def dispatch Node<?> toNode(NodeIdentifierWithPredicates argument, Node<?> node) {
-        val list = new ArrayList<Node<?>>();
-        for (arg : argument.keyValues.entrySet) {
-            list.add = new SimpleNodeTOImpl(arg.key, null, arg.value);
-        }
-        if (node != null) {
-            list.add(node);
-        }
-        return new CompositeNodeTOImpl(argument.nodeType, null, list)
-    }
-
-    static def dispatch Node<?> toNode(PathArgument argument, Node<?> node) {
-        if (node != null) {
-            return new CompositeNodeTOImpl(argument.nodeType, null, Collections.singletonList(node));
-        } else {
-            return new SimpleNodeTOImpl(argument.nodeType, null, null);
-        }
-    }
-
-    static def CompositeNode toCompositeNode(NetconfMessage message,Optional<SchemaContext> ctx) {
-        //TODO: implement general normalization to normalize incoming Netconf Message
-        // for Schema Context counterpart
-        return null
-    }
-
-    static def CompositeNode toNotificationNode(NetconfMessage message,Optional<SchemaContext> ctx) {
-        if (ctx.present) {
-            val schemaContext = ctx.get
-            val notifications = schemaContext.notifications
-            val document = message.document
-            return XmlDocumentUtils.notificationToDomNodes(document, Optional.<Set<NotificationDefinition>>fromNullable(notifications))
-        }
-        return null
-    }
-
-    static def NetconfMessage toRpcMessage(QName rpc, CompositeNode node,Optional<SchemaContext> ctx) {
-        val rpcPayload = wrap(NETCONF_RPC_QNAME, flattenInput(node))
-        val w3cPayload = XmlDocumentUtils.toDocument(rpcPayload, XmlDocumentUtils.defaultValueCodecProvider)
-        w3cPayload.documentElement.setAttribute("message-id", "m-" + messageId.andIncrement)
-        return new NetconfMessage(w3cPayload);
-    }
-
-    def static flattenInput(CompositeNode node) {
-        val inputQName = QName.create(node.nodeType,"input");
-        val input = node.getFirstCompositeByName(inputQName);
-        if(input == null) return node;
-        if(input instanceof CompositeNode) {
-
-            val nodes = ImmutableList.builder() //
-                .addAll(input.children) //
-                .addAll(node.children.filter[nodeType != inputQName]) //
-                .build()
-            return ImmutableCompositeNode.create(node.nodeType,nodes);
-        }
-
-    }
-
-    static def RpcResult<CompositeNode> toRpcResult(NetconfMessage message,QName rpc,Optional<SchemaContext> context) {
-        var CompositeNode rawRpc;
-        if(context.present) {
-            if(isDataRetrievalReply(rpc)) {
-
-                val xmlData = message.document.dataSubtree
-                val dataNodes = XmlDocumentUtils.toDomNodes(xmlData, Optional.of(context.get.dataDefinitions))
-
-                val it = ImmutableCompositeNode.builder()
-                setQName(NETCONF_RPC_REPLY_QNAME)
-                add(ImmutableCompositeNode.create(NETCONF_DATA_QNAME, dataNodes));
-
-                rawRpc = it.toInstance;
-                //sys(xmlData)
-            } else {
-                val rpcSchema = context.get.operations.findFirst[QName == rpc]
-                rawRpc = message.document.toCompositeNode() as CompositeNode;
-            }
-        } else {
-            rawRpc = message.document.toCompositeNode() as CompositeNode;
-        }
-        //rawRpc.
-        return Rpcs.getRpcResult(true, rawRpc, Collections.emptySet());
-    }
-
-    def static Element getDataSubtree(Document doc) {
-        doc.getElementsByTagNameNS(NETCONF_URI.toString,"data").item(0) as Element
-    }
-
-    def static boolean isDataRetrievalReply(QName it) {
-        return NETCONF_URI == namespace && ( localName == NETCONF_GET_CONFIG_QNAME.localName || localName == NETCONF_GET_QNAME.localName)
-    }
-
-    static def wrap(QName name, Node<?> node) {
-        if (node != null) {
-            return new CompositeNodeTOImpl(name, null, Collections.singletonList(node));
-        } else {
-            return new CompositeNodeTOImpl(name, null, Collections.emptyList());
-        }
-    }
-
-    static def wrap(QName name, Node<?> additional, Node<?> node) {
-        if (node != null) {
-            return new CompositeNodeTOImpl(name, null, ImmutableList.of(additional, node));
-        } else {
-            return new CompositeNodeTOImpl(name, null, ImmutableList.of(additional));
-        }
-    }
-
-    static def filter(String type, Node<?> node) {
-        val it = ImmutableCompositeNode.builder(); //
-        setQName(NETCONF_FILTER_QNAME);
-        setAttribute(NETCONF_TYPE_QNAME,type);
-        if (node != null) {
-            return add(node).toInstance();
-        } else {
-            return toInstance();
-        }
-    }
-
-    public static def Node<?> toCompositeNode(Document document) {
-        return XmlDocumentUtils.toDomNode(document) as Node<?>
-    }
-
-    public static def checkValidReply(NetconfMessage input, NetconfMessage output) {
-        val inputMsgId = input.document.documentElement.getAttribute("message-id")
-        val outputMsgId = output.document.documentElement.getAttribute("message-id")
-        Preconditions.checkState(inputMsgId == outputMsgId,"Rpc request and reply message IDs must be same.");
-
-    }
-
-}
index c734e80..abd935d 100644 (file)
@@ -20,6 +20,8 @@ import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProvider;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 class NetconfRemoteSchemaSourceProvider implements SchemaSourceProvider<String> {
 
@@ -30,8 +32,11 @@ class NetconfRemoteSchemaSourceProvider implements SchemaSourceProvider<String>
 
     private final NetconfDevice device;
 
+    private final Logger logger;
+
     public NetconfRemoteSchemaSourceProvider(NetconfDevice device) {
         this.device = Preconditions.checkNotNull(device);
+        logger = LoggerFactory.getLogger(NetconfDevice.class + "#" + device.getName());
     }
 
     @Override
@@ -44,7 +49,7 @@ class NetconfRemoteSchemaSourceProvider implements SchemaSourceProvider<String>
             request.addLeaf("version", revision.get());
         }
 
-        device.logger.trace("Loading YANG schema source for {}:{}", moduleName, revision);
+        logger.trace("Loading YANG schema source for {}:{}", moduleName, revision);
         try {
             RpcResult<CompositeNode> schemaReply = device.invokeRpc(GET_SCHEMA_QNAME, request.toInstance()).get();
             if (schemaReply.isSuccessful()) {
@@ -54,9 +59,9 @@ class NetconfRemoteSchemaSourceProvider implements SchemaSourceProvider<String>
                     return Optional.of(schemaBody);
                 }
             }
-            device.logger.warn("YANG shcema was not successfully retrieved.");
+            logger.warn("YANG shcema was not successfully retrieved.");
         } catch (InterruptedException | ExecutionException e) {
-            device.logger.warn("YANG shcema was not successfully retrieved.", e);
+            logger.warn("YANG shcema was not successfully retrieved.", e);
         }
         return Optional.absent();
     }
index f49771a..065d0ee 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.sample.l2switch.md.flow;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
+
 import org.opendaylight.controller.sample.l2switch.md.topology.NetworkGraphService;
 import org.opendaylight.controller.sample.l2switch.md.util.InstanceIdentifierUtils;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
@@ -25,6 +26,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.ta
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
@@ -261,7 +263,7 @@ public class FlowWriterServiceImpl implements FlowWriterService {
         .setBufferId(0L) //
         .setHardTimeout(0) //
         .setIdleTimeout(0) //
-        .setCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement()))
+        .setCookie(new FlowCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement())))
         .setFlags(new FlowModFlags(false, false, false, false, false));
 
     return macToMacFlow.build();
index c4334ab..5ace260 100644 (file)
@@ -88,8 +88,12 @@ public final class NodeStatisticsHandler implements AutoCloseable, FlowCapableCo
     private final TimerTask task = new TimerTask() {
         @Override
         public void run() {
-            requestPeriodicStatistics();
-            cleanStaleStatistics();
+            try{
+                requestPeriodicStatistics();
+                cleanStaleStatistics();
+            }catch(Exception e){
+                logger.warn("Exception occured while sending statistics request : {}",e);
+            }
         }
     };
 
index 2d003f8..a51f6c2 100644 (file)
       <groupId>equinoxSDK381</groupId>
       <artifactId>org.eclipse.osgi</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.eclipse.xtend</groupId>
-      <artifactId>org.eclipse.xtend.lib</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal</artifactId>
           <manifestLocation>${project.basedir}/META-INF</manifestLocation>
         </configuration>
       </plugin>
-      <plugin>
-        <groupId>org.eclipse.xtend</groupId>
-        <artifactId>xtend-maven-plugin</artifactId>
-      </plugin>
     </plugins>
   </build>
   <scm>
diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.java b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.java
new file mode 100644 (file)
index 0000000..0e003db
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.md.controller.topology.lldp;
+
+import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.osgi.framework.BundleContext;
+
+public class LLDPActivator extends AbstractBindingAwareProvider {
+    private static LLDPDiscoveryProvider provider = new LLDPDiscoveryProvider();
+
+    public void onSessionInitiated(final ProviderContext session) {
+        DataProviderService dataService = session.<DataProviderService>getSALService(DataProviderService.class);
+        provider.setDataService(dataService);
+        NotificationProviderService notificationService = session.<NotificationProviderService>getSALService(NotificationProviderService.class);
+        provider.setNotificationService(notificationService);
+        provider.start();
+    }
+
+    protected void stopImpl(final BundleContext context) {
+        provider.close();
+    }
+}
diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.xtend b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPActivator.xtend
deleted file mode 100644 (file)
index 674e919..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- * 
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.md.controller.topology.lldp
-
-import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService
-import org.osgi.framework.BundleContext
-
-class LLDPActivator extends AbstractBindingAwareProvider {
-
-    static var LLDPDiscoveryProvider provider = new LLDPDiscoveryProvider();
-
-    override onSessionInitiated(ProviderContext session) {
-        provider.dataService = session.getSALService(DataProviderService)
-        provider.notificationService = session.getSALService(NotificationProviderService)
-        provider.start();
-    }
-
-    override protected stopImpl(BundleContext context) {
-        provider.close();
-    }
-
-}
diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.java b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.java
new file mode 100644 (file)
index 0000000..b219722
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.md.controller.topology.lldp;
+
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.yang.binding.NotificationListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LLDPDiscoveryProvider implements AutoCloseable {
+    private final static Logger LOG =  LoggerFactory.getLogger(LLDPDiscoveryProvider.class);
+    private DataProviderService dataService;
+    private NotificationProviderService notificationService;
+    private final LLDPDiscoveryListener commiter = new LLDPDiscoveryListener(LLDPDiscoveryProvider.this);
+    private Registration<NotificationListener> listenerRegistration;
+
+    public DataProviderService getDataService() {
+        return this.dataService;
+    }
+
+    public void setDataService(final DataProviderService dataService) {
+        this.dataService = dataService;
+    }
+
+    public NotificationProviderService getNotificationService() {
+        return this.notificationService;
+    }
+
+    public void setNotificationService(final NotificationProviderService notificationService) {
+        this.notificationService = notificationService;
+    }
+
+    public void start() {
+        Registration<NotificationListener> registerNotificationListener = this.getNotificationService().registerNotificationListener(this.commiter);
+        this.listenerRegistration = registerNotificationListener;
+        LLDPLinkAger.getInstance().setManager(this);
+        LOG.info("LLDPDiscoveryListener Started.");
+    }
+
+    public void close() {
+        try {
+            LOG.info("LLDPDiscoveryListener stopped.");
+            if (this.listenerRegistration!=null) {
+                this.listenerRegistration.close();
+            }
+            LLDPLinkAger.getInstance().close();
+        } catch (Exception e) {
+            throw new Error(e);
+        }
+    }
+}
diff --git a/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.xtend b/opendaylight/md-sal/topology-lldp-discovery/src/main/java/org/opendaylight/md/controller/topology/lldp/LLDPDiscoveryProvider.xtend
deleted file mode 100644 (file)
index fc724ac..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- * 
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.md.controller.topology.lldp
-
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService
-import org.opendaylight.yangtools.concepts.Registration
-import org.opendaylight.yangtools.yang.binding.NotificationListener
-import org.slf4j.LoggerFactory
-
-class LLDPDiscoveryProvider implements AutoCloseable {
-
-
-    static val LOG = LoggerFactory.getLogger(LLDPDiscoveryProvider);
-
-    @Property
-    DataProviderService dataService;        
-
-    @Property
-    NotificationProviderService notificationService;
-
-    val LLDPDiscoveryListener commiter = new LLDPDiscoveryListener(this);
-
-    Registration<NotificationListener> listenerRegistration
-
-    def void start() {
-        listenerRegistration = notificationService.registerNotificationListener(commiter);
-        LLDPLinkAger.instance.manager = this;
-        LOG.info("LLDPDiscoveryListener Started.");
-        
-    }   
-    
-    override close() {
-       LOG.info("LLDPDiscoveryListener stopped.");
-        listenerRegistration?.close();
-        LLDPLinkAger.instance.close();
-    }
-    
-}
-
-
index 2a0f0a9..c10f0a9 100644 (file)
                             org.opendaylight.controller.netconf.confignetconfconnector.transactions,
                             org.opendaylight.controller.netconf.confignetconfconnector.util,
                             org.opendaylight.controller.netconf.confignetconfconnector.osgi,
-                            org.opendaylight.controller.config.util,</Private-Package>
+                            org.opendaylight.controller.config.util,
+                            org.opendaylight.controller.netconf.confignetconfconnector.exception,</Private-Package>
             <Import-Package>com.google.common.base,
                             com.google.common.collect,
                             javax.annotation,
                             org.opendaylight.controller.netconf.mapping.api,
                             org.opendaylight.controller.netconf.util.mapping,
                             org.opendaylight.controller.netconf.util.xml,
+                            org.opendaylight.controller.netconf.util.exception,
                             org.opendaylight.yangtools.yang.common,
                             org.opendaylight.yangtools.yang.model.api,
                             org.osgi.framework,
                             com.google.common.io,
                             org.opendaylight.yangtools.yang.model.api.type,
                             org.opendaylight.yangtools.sal.binding.generator.spi,
-                            org.opendaylight.yangtools.sal.binding.yang.types</Import-Package>
+                            org.opendaylight.yangtools.sal.binding.yang.types,</Import-Package>
             <Export-Package></Export-Package>
           </instructions>
         </configuration>
diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/exception/NetconfConfigHandlingException.java b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/exception/NetconfConfigHandlingException.java
new file mode 100644 (file)
index 0000000..be44a71
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.netconf.confignetconfconnector.exception;
+
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
+
+import java.util.Collections;
+import java.util.Map;
+
+public class NetconfConfigHandlingException extends NetconfDocumentedException {
+
+    public NetconfConfigHandlingException(final String message, final ErrorType errorType, final ErrorTag errorTag,
+                                          final ErrorSeverity errorSeverity) {
+        this(message, errorType, errorTag, errorSeverity, Collections.<String, String>emptyMap());
+    }
+
+    public NetconfConfigHandlingException(final String message, final ErrorType errorType, final ErrorTag errorTag,
+                                          final ErrorSeverity errorSeverity, final Map<String, String> errorInfo){
+        super(message,errorType,errorTag,errorSeverity,errorInfo);
+    }
+}
diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/exception/NoTransactionFoundException.java b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/exception/NoTransactionFoundException.java
new file mode 100644 (file)
index 0000000..ebb8054
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.netconf.confignetconfconnector.exception;
+
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
+
+import java.util.Collections;
+import java.util.Map;
+
+public class NoTransactionFoundException extends NetconfDocumentedException {
+
+    public NoTransactionFoundException(final String message, final ErrorType errorType, final ErrorTag errorTag,
+                                          final ErrorSeverity errorSeverity) {
+        this(message, errorType, errorTag, errorSeverity, Collections.<String, String> emptyMap());
+    }
+
+    public NoTransactionFoundException(final String message, final ErrorType errorType, final ErrorTag errorTag,
+                                          final ErrorSeverity errorSeverity, final Map<String, String> errorInfo){
+        super(message,errorType,errorTag,errorSeverity,errorInfo);
+    }
+
+}
diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/exception/OperationNotPermittedException.java b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/exception/OperationNotPermittedException.java
new file mode 100644 (file)
index 0000000..e0d63c1
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.netconf.confignetconfconnector.exception;
+
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
+
+import java.util.Collections;
+import java.util.Map;
+
+public class OperationNotPermittedException extends NetconfDocumentedException {
+
+    public OperationNotPermittedException(final String message, final ErrorType errorType, final ErrorTag errorTag,
+                                       final ErrorSeverity errorSeverity) {
+        this(message, errorType, errorTag, errorSeverity, Collections.<String, String> emptyMap());
+    }
+
+    public OperationNotPermittedException(final String message, final ErrorType errorType, final ErrorTag errorTag,
+                                       final ErrorSeverity errorSeverity, final Map<String, String> errorInfo){
+        super(message,errorType,errorTag,errorSeverity,errorInfo);
+    }
+}
index 54d24a4..c08be06 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition;
 
 public abstract class AttributeIfcSwitchStatement<T> {
 
-    protected AttributeIfc lastAttribute;
+    private AttributeIfc lastAttribute;
 
     public T switchAttribute(AttributeIfc attributeIfc) {
 
@@ -39,8 +39,9 @@ public abstract class AttributeIfcSwitchStatement<T> {
                     return caseJavaUnionAttribute(openType);
                 } else if(((JavaAttribute)attributeIfc).isIdentityRef()) {
                     return caseJavaIdentityRefAttribute(openType);
-                } else
+                } else {
                     return caseJavaAttribute(openType);
+                }
             } catch (UnknownOpenTypeException e) {
                 throw getIllegalArgumentException(attributeIfc);
             }
@@ -58,6 +59,10 @@ public abstract class AttributeIfcSwitchStatement<T> {
         throw getIllegalArgumentException(attributeIfc);
     }
 
+    public AttributeIfc getLastAttribute() {
+        return lastAttribute;
+    }
+
     protected T caseJavaIdentityRefAttribute(OpenType<?> openType) {
         return caseJavaAttribute(openType);
     }
index 7939112..701e96e 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml;
 
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 
 import java.util.List;
@@ -25,14 +26,14 @@ public abstract class AbstractAttributeReadingStrategy implements AttributeReadi
     }
 
     @Override
-    public AttributeConfigElement readElement(List<XmlElement> configNodes) {
-        if (configNodes.size() == 0)
+    public AttributeConfigElement readElement(List<XmlElement> configNodes) throws NetconfDocumentedException {
+        if (configNodes.size() == 0){
             return AttributeConfigElement.createNullValue(postprocessNullableDefault(nullableDefault));
-
+        }
         return readElementHook(configNodes);
     }
 
-    abstract AttributeConfigElement readElementHook(List<XmlElement> configNodes);
+    abstract AttributeConfigElement readElementHook(List<XmlElement> configNodes) throws NetconfDocumentedException;
 
     protected Object postprocessNullableDefault(String nullableDefault) {
         return nullableDefault;
index 8f56961..442c504 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml;
 
 import com.google.common.collect.Lists;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 
 import java.util.List;
@@ -27,7 +28,7 @@ public class ArrayAttributeReadingStrategy extends AbstractAttributeReadingStrat
     }
 
     @Override
-    AttributeConfigElement readElementHook(List<XmlElement> configNodes) {
+    AttributeConfigElement readElementHook(List<XmlElement> configNodes) throws NetconfDocumentedException {
         List<Object> innerList = Lists.newArrayList();
         for (int i = 0; i < configNodes.size(); i++) {
             innerList.add(innerStrategy.readElement(Lists.newArrayList(configNodes.get(i))).getValue());
index dbc1b48..dcc2fa1 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml;
 
 import com.google.common.base.Optional;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.resolving.AttributeResolvingStrategy;
 
 import javax.management.openmbean.OpenType;
@@ -39,7 +40,7 @@ public class AttributeConfigElement {
     }
 
     public void resolveValue(AttributeResolvingStrategy<?, ? extends OpenType<?>> attributeResolvingStrategy,
-            String attrName) {
+            String attrName) throws NetconfDocumentedException {
         resolvedValue = attributeResolvingStrategy.parseAttribute(attrName, value);
         Optional<?> resolvedDefault = attributeResolvingStrategy.parseAttribute(attrName, dafaultValue);
         resolvedDefaultValue = resolvedDefault.isPresent() ? resolvedDefault.get() : null;
index 6dae839..4e78370 100644 (file)
@@ -10,10 +10,11 @@ package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attri
 
 import java.util.List;
 
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 
 public interface AttributeReadingStrategy {
 
-    public abstract AttributeConfigElement readElement(List<XmlElement> element);
+    public abstract AttributeConfigElement readElement(List<XmlElement> element) throws NetconfDocumentedException;
 
 }
index fdbfb98..792fb28 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attri
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 
 import java.util.List;
@@ -28,7 +29,7 @@ public class CompositeAttributeReadingStrategy extends AbstractAttributeReadingS
     }
 
     @Override
-    AttributeConfigElement readElementHook(List<XmlElement> configNodes) {
+    AttributeConfigElement readElementHook(List<XmlElement> configNodes) throws NetconfDocumentedException {
 
         Preconditions.checkState(configNodes.size() == 1, "This element should be present only once %s", configNodes);
 
@@ -38,7 +39,8 @@ public class CompositeAttributeReadingStrategy extends AbstractAttributeReadingS
 
         List<XmlElement> recognisedChildren = Lists.newArrayList();
         for (Entry<String, AttributeReadingStrategy> innerAttrEntry : innerStrategies.entrySet()) {
-            List<XmlElement> childItem = complexElement.getChildElementsWithSameNamespace(innerAttrEntry.getKey());
+            List<XmlElement> childItem = null;
+            childItem = complexElement.getChildElementsWithSameNamespace(innerAttrEntry.getKey());
             recognisedChildren.addAll(childItem);
 
             AttributeConfigElement resolvedInner = innerAttrEntry.getValue().readElement(childItem);
index 7a4ba31..bf9eee7 100644 (file)
@@ -8,9 +8,12 @@
 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml;
 
 import com.google.common.base.Preconditions;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.mapping.ObjectNameAttributeMappingStrategy;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.List;
 import java.util.Map;
@@ -18,13 +21,14 @@ import java.util.Map;
 public class ObjectNameAttributeReadingStrategy extends AbstractAttributeReadingStrategy {
 
     private static final Object PREFIX_SEPARATOR = ":";
+    private static final Logger logger = LoggerFactory.getLogger(ObjectNameAttributeReadingStrategy.class);
 
     public ObjectNameAttributeReadingStrategy(String nullableDefault) {
         super(nullableDefault);
     }
 
     @Override
-    AttributeConfigElement readElementHook(List<XmlElement> configNodes) {
+    AttributeConfigElement readElementHook(List<XmlElement> configNodes) throws NetconfDocumentedException {
 
         XmlElement firstChild = configNodes.get(0);
         Preconditions.checkState(configNodes.size() == 1, "This element should be present only once " + firstChild
@@ -34,8 +38,9 @@ public class ObjectNameAttributeReadingStrategy extends AbstractAttributeReading
         return AttributeConfigElement.create(getNullableDefault(), resolve(firstChild));
     }
 
-    private ObjectNameAttributeMappingStrategy.MappedDependency resolve(XmlElement firstChild) {
-        XmlElement typeElement = firstChild.getOnlyChildElementWithSameNamespace(XmlNetconfConstants.TYPE_KEY);
+    private ObjectNameAttributeMappingStrategy.MappedDependency resolve(XmlElement firstChild) throws NetconfDocumentedException{
+        XmlElement typeElement = null;
+        typeElement = firstChild.getOnlyChildElementWithSameNamespace(XmlNetconfConstants.TYPE_KEY);
         Map.Entry<String, String> prefixNamespace = typeElement.findNamespaceOfTextContent();
 
         String serviceName = checkPrefixAndExtractServiceName(typeElement, prefixNamespace);
@@ -47,10 +52,10 @@ public class ObjectNameAttributeReadingStrategy extends AbstractAttributeReading
                 dependencyName);
     }
 
-    public static String checkPrefixAndExtractServiceName(XmlElement typeElement, Map.Entry<String, String> prefixNamespace) {
+    public static String checkPrefixAndExtractServiceName(XmlElement typeElement, Map.Entry<String, String> prefixNamespace) throws NetconfDocumentedException {
         String serviceName = typeElement.getTextContent();
 
-        Preconditions.checkState(prefixNamespace.equals("") == false, "Service %s value not prefixed with namespace",
+        Preconditions.checkState(!prefixNamespace.equals(""), "Service %s value not prefixed with namespace",
                 XmlNetconfConstants.TYPE_KEY);
         String prefix = prefixNamespace.getKey() + PREFIX_SEPARATOR;
         Preconditions.checkState(serviceName.startsWith(prefix),
index 61db74f..61ea76b 100644 (file)
@@ -50,31 +50,31 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement<AttributeReadin
 
     @Override
     protected AttributeReadingStrategy caseJavaBinaryAttribute(OpenType<?> openType) {
-        return new SimpleBinaryAttributeReadingStrategy(lastAttribute.getNullableDefault());
+        return new SimpleBinaryAttributeReadingStrategy(getLastAttribute().getNullableDefault());
     }
 
     @Override
     protected AttributeReadingStrategy caseJavaUnionAttribute(OpenType<?> openType) {
         String mappingKey = JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION;
-        return new SimpleUnionAttributeReadingStrategy(lastAttribute.getNullableDefault(), mappingKey);
+        return new SimpleUnionAttributeReadingStrategy(getLastAttribute().getNullableDefault(), mappingKey);
     }
 
     @Override
     public AttributeReadingStrategy caseJavaSimpleAttribute(SimpleType<?> openType) {
-        return new SimpleAttributeReadingStrategy(lastAttribute.getNullableDefault());
+        return new SimpleAttributeReadingStrategy(getLastAttribute().getNullableDefault());
     }
 
     @Override
     public AttributeReadingStrategy caseJavaArrayAttribute(ArrayType<?> openType) {
-        SimpleAttributeReadingStrategy innerStrategy = new SimpleAttributeReadingStrategy(lastAttribute.getNullableDefault());
-        return new ArrayAttributeReadingStrategy(lastAttribute.getNullableDefault(), innerStrategy);
+        SimpleAttributeReadingStrategy innerStrategy = new SimpleAttributeReadingStrategy(getLastAttribute().getNullableDefault());
+        return new ArrayAttributeReadingStrategy(getLastAttribute().getNullableDefault(), innerStrategy);
     }
 
     @Override
     public AttributeReadingStrategy caseJavaCompositeAttribute(CompositeType openType) {
         Preconditions.checkState(openType.keySet().size() == 1, "Unexpected number of elements for open type %s, should be 1", openType);
         String mappingKey = openType.keySet().iterator().next();
-        return new SimpleCompositeAttributeReadingStrategy(lastAttribute.getNullableDefault(), mappingKey);
+        return new SimpleCompositeAttributeReadingStrategy(getLastAttribute().getNullableDefault(), mappingKey);
     }
 
     @Override
@@ -83,18 +83,18 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement<AttributeReadin
         Set<String> keys = ((CompositeType) openType).keySet();
         Preconditions.checkState(keys.size() == 1, "Unexpected number of elements for open type %s, should be 1", openType);
         String mappingKey = keys.iterator().next();
-        return new SimpleIdentityRefAttributeReadingStrategy(lastAttribute.getNullableDefault(), mappingKey, identityMap);
+        return new SimpleIdentityRefAttributeReadingStrategy(getLastAttribute().getNullableDefault(), mappingKey, identityMap);
     }
 
     @Override
     protected AttributeReadingStrategy caseDependencyAttribute(SimpleType<?> openType) {
-        return new ObjectNameAttributeReadingStrategy(lastAttribute.getNullableDefault());
+        return new ObjectNameAttributeReadingStrategy(getLastAttribute().getNullableDefault());
     }
 
     @Override
     protected AttributeReadingStrategy caseTOAttribute(CompositeType openType) {
-        Preconditions.checkState(lastAttribute instanceof TOAttribute);
-        Map<String, AttributeIfc> inner = ((TOAttribute)lastAttribute).getYangPropertiesToTypesMap();
+        Preconditions.checkState(getLastAttribute() instanceof TOAttribute);
+        Map<String, AttributeIfc> inner = ((TOAttribute)getLastAttribute()).getYangPropertiesToTypesMap();
 
         Map<String, AttributeReadingStrategy> innerStrategies = Maps.newHashMap();
 
@@ -104,21 +104,21 @@ public class ObjectXmlReader extends AttributeIfcSwitchStatement<AttributeReadin
             innerStrategies.put(innerAttrEntry.getKey(), innerStrat);
         }
 
-        return new CompositeAttributeReadingStrategy(lastAttribute.getNullableDefault(), innerStrategies);
+        return new CompositeAttributeReadingStrategy(getLastAttribute().getNullableDefault(), innerStrategies);
     }
 
     @Override
     protected AttributeReadingStrategy caseListAttribute(ArrayType<?> openType) {
-        Preconditions.checkState(lastAttribute instanceof ListAttribute);
-        AttributeReadingStrategy innerStrategy = prepareReadingStrategy(key, ((ListAttribute) lastAttribute).getInnerAttribute());
-        return new ArrayAttributeReadingStrategy(lastAttribute.getNullableDefault(), innerStrategy);
+        Preconditions.checkState(getLastAttribute() instanceof ListAttribute);
+        AttributeReadingStrategy innerStrategy = prepareReadingStrategy(key, ((ListAttribute) getLastAttribute()).getInnerAttribute());
+        return new ArrayAttributeReadingStrategy(getLastAttribute().getNullableDefault(), innerStrategy);
     }
 
     @Override
     protected AttributeReadingStrategy caseListDependeciesAttribute(ArrayType<?> openType) {
-        Preconditions.checkState(lastAttribute instanceof ListDependenciesAttribute);
+        Preconditions.checkState(getLastAttribute() instanceof ListDependenciesAttribute);
         AttributeReadingStrategy innerStrategy = caseDependencyAttribute(SimpleType.OBJECTNAME);
-        return new ArrayAttributeReadingStrategy(lastAttribute.getNullableDefault(), innerStrategy);
+        return new ArrayAttributeReadingStrategy(getLastAttribute().getNullableDefault(), innerStrategy);
     }
 
 }
index 3765a13..cb8f660 100644 (file)
@@ -9,12 +9,12 @@
 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml;
 
 import com.google.common.base.Preconditions;
+import java.util.List;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.List;
-
 public class SimpleAttributeReadingStrategy extends AbstractAttributeReadingStrategy {
     private static final Logger logger = LoggerFactory.getLogger(SimpleAttributeReadingStrategy.class);
 
@@ -24,7 +24,7 @@ public class SimpleAttributeReadingStrategy extends AbstractAttributeReadingStra
     }
 
     @Override
-    AttributeConfigElement readElementHook(List<XmlElement> configNodes) {
+    AttributeConfigElement readElementHook(List<XmlElement> configNodes) throws NetconfDocumentedException {
         XmlElement xmlElement = configNodes.get(0);
         Preconditions.checkState(configNodes.size() == 1, "This element should be present only once " + xmlElement
                 + " but was " + configNodes.size());
@@ -37,12 +37,17 @@ public class SimpleAttributeReadingStrategy extends AbstractAttributeReadingStra
             logger.warn("Ignoring exception caused by failure to read text element", e);
         }
 
-        Preconditions.checkNotNull(textContent, "This element should contain text %s", xmlElement);
+        if (null == textContent){
+            throw new NetconfDocumentedException(String.format("This element should contain text %s", xmlElement),
+                    NetconfDocumentedException.ErrorType.application,
+                    NetconfDocumentedException.ErrorTag.invalid_value,
+                    NetconfDocumentedException.ErrorSeverity.error);
+        }
         return AttributeConfigElement.create(postprocessNullableDefault(getNullableDefault()),
                 postprocessParsedValue(textContent));
     }
 
-    protected String readElementContent(XmlElement xmlElement) {
+    protected String readElementContent(XmlElement xmlElement) throws NetconfDocumentedException {
         return xmlElement.getTextContent();
     }
 
index 1205597..8e7ba70 100644 (file)
@@ -15,6 +15,7 @@ import java.util.Map;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Maps;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.EditConfig;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -32,7 +33,7 @@ public class SimpleIdentityRefAttributeReadingStrategy extends SimpleAttributeRe
     }
 
     @Override
-    protected String readElementContent(XmlElement xmlElement) {
+    protected String readElementContent(XmlElement xmlElement) throws NetconfDocumentedException {
         // TODO test
         Map.Entry<String, String> namespaceOfTextContent = xmlElement.findNamespaceOfTextContent();
         String content = xmlElement.getTextContent();
@@ -53,9 +54,9 @@ public class SimpleIdentityRefAttributeReadingStrategy extends SimpleAttributeRe
                     revision = date;
                 }
             }
-        } else
+        } else {
             revision = revisions.keySet().iterator().next();
-
+        }
 
         return QName.create(URI.create(namespace), revision, localName).toString();
     }
index 30436bb..54ffe08 100644 (file)
@@ -30,8 +30,9 @@ public class ArrayAttributeMappingStrategy extends AbstractAttributeMappingStrat
 
     @Override
     public Optional<List<Object>> mapAttribute(Object value) {
-        if (value == null)
+        if (value == null){
             return Optional.absent();
+        }
 
         Preconditions.checkArgument(value.getClass().isArray(), "Value has to be instanceof Array ");
 
@@ -39,19 +40,11 @@ public class ArrayAttributeMappingStrategy extends AbstractAttributeMappingStrat
 
         for (int i = 0; i < Array.getLength(value); i++) {
             Object innerValue = Array.get(value, i);
-            // String expectedClassName =
-            // getOpenType().getElementOpenType().getClassName();
-            // String realClassName = value.getClass().getName();
-
-            // Preconditions.checkState(realClassName.contains(expectedClassName),
-            // "Element in collection/array should be of type " +
-            // expectedClassName + " but was "
-            // + realClassName + " for attribute: " + getOpenType());
-
             Optional<?> mapAttribute = innerElementStrategy.mapAttribute(innerValue);
 
-            if (mapAttribute.isPresent())
+            if (mapAttribute.isPresent()){
                 retVal.add(mapAttribute.get());
+            }
         }
 
         return Optional.of(retVal);
index 368e1f1..594953e 100644 (file)
@@ -35,8 +35,9 @@ public class CompositeAttributeMappingStrategy extends
 
     @Override
     public Optional<Map<String, Object>> mapAttribute(Object value) {
-        if (value == null)
+        if (value == null){
             return Optional.absent();
+        }
 
         Util.checkType(value, CompositeDataSupport.class);
 
@@ -54,8 +55,9 @@ public class CompositeAttributeMappingStrategy extends
 
         for (String jmxName : jmxToJavaNameMapping.keySet()) {
             Optional<?> mapped = mapInnerAttribute(compositeData, jmxName, expectedType.getDescription(jmxName));
-            if(mapped.isPresent())
+            if(mapped.isPresent()){
                 retVal.put(jmxToJavaNameMapping.get(jmxName), mapped.get());
+            }
         }
 
         return Optional.of(retVal);
@@ -66,8 +68,7 @@ public class CompositeAttributeMappingStrategy extends
 
         AttributeMappingStrategy<?, ? extends OpenType<?>> attributeMappingStrategy = innerStrategies
                 .get(jmxName);
-        Optional<?> mapAttribute = attributeMappingStrategy.mapAttribute(innerValue);
-        return mapAttribute;
+        return attributeMappingStrategy.mapAttribute(innerValue);
     }
 
 }
index 506d7d6..01844f2 100644 (file)
@@ -112,7 +112,7 @@ public class ObjectMapper extends AttributeIfcSwitchStatement<AttributeMappingSt
     @Override
     protected AttributeMappingStrategy<?, ? extends OpenType<?>> caseDependencyAttribute(
             SimpleType<?> openType) {
-        return new ObjectNameAttributeMappingStrategy(openType, dependencyTracker,
+        return new ObjectNameAttributeMappingStrategy(openType,
                 serviceNameOfDepAttr, namespaceOfDepAttr);
     }
 
@@ -120,10 +120,10 @@ public class ObjectMapper extends AttributeIfcSwitchStatement<AttributeMappingSt
     protected AttributeMappingStrategy<?, ? extends OpenType<?>> caseTOAttribute(CompositeType openType) {
         Map<String, AttributeMappingStrategy<?, ? extends OpenType<?>>> innerStrategies = Maps.newHashMap();
 
-        Preconditions.checkState(lastAttribute instanceof TOAttribute);
-        TOAttribute lastTO = (TOAttribute) lastAttribute;
+        Preconditions.checkState(getLastAttribute() instanceof TOAttribute);
+        TOAttribute lastTO = (TOAttribute) getLastAttribute();
 
-        for (Entry<String, AttributeIfc> innerAttrEntry : ((TOAttribute)lastAttribute).getJmxPropertiesToTypesMap().entrySet()) {
+        for (Entry<String, AttributeIfc> innerAttrEntry : ((TOAttribute)getLastAttribute()).getJmxPropertiesToTypesMap().entrySet()) {
             innerStrategies.put(innerAttrEntry.getKey(), prepareStrategy(innerAttrEntry.getValue()));
         }
 
@@ -133,14 +133,14 @@ public class ObjectMapper extends AttributeIfcSwitchStatement<AttributeMappingSt
 
     @Override
     protected AttributeMappingStrategy<?, ? extends OpenType<?>> caseListAttribute(ArrayType<?> openType) {
-        Preconditions.checkState(lastAttribute instanceof ListAttribute);
+        Preconditions.checkState(getLastAttribute() instanceof ListAttribute);
         return new ArrayAttributeMappingStrategy(openType,
-                prepareStrategy(((ListAttribute) lastAttribute).getInnerAttribute()));
+                prepareStrategy(((ListAttribute) getLastAttribute()).getInnerAttribute()));
     }
 
     @Override
     protected AttributeMappingStrategy<?, ? extends OpenType<?>> caseListDependeciesAttribute(ArrayType<?> openType) {
-        Preconditions.checkState(lastAttribute instanceof ListDependenciesAttribute);
+        Preconditions.checkState(getLastAttribute() instanceof ListDependenciesAttribute);
         return new ArrayAttributeMappingStrategy(openType, caseDependencyAttribute(SimpleType.OBJECTNAME));
     }
 
index 83e8086..b827a5b 100644 (file)
@@ -10,31 +10,28 @@ package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attri
 
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
-import org.opendaylight.controller.config.api.jmx.ObjectNameUtil;
-import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.ServiceRegistryWrapper;
-import org.opendaylight.controller.netconf.confignetconfconnector.util.Util;
-
 import javax.management.ObjectName;
 import javax.management.openmbean.SimpleType;
+import org.opendaylight.controller.config.api.jmx.ObjectNameUtil;
+import org.opendaylight.controller.netconf.confignetconfconnector.util.Util;
 
 public class ObjectNameAttributeMappingStrategy extends
         AbstractAttributeMappingStrategy<ObjectNameAttributeMappingStrategy.MappedDependency, SimpleType<?>> {
 
-    private final ServiceRegistryWrapper tracker;
     private final String serviceName;
     private final String namespace;
 
-    public ObjectNameAttributeMappingStrategy(SimpleType<?> openType, ServiceRegistryWrapper dependencyTracker, String serviceName, String namespace) {
+    public ObjectNameAttributeMappingStrategy(SimpleType<?> openType,  String serviceName, String namespace) {
         super(openType);
-        this.tracker = dependencyTracker;
         this.serviceName = serviceName;
         this.namespace = namespace;
     }
 
     @Override
     public Optional<MappedDependency> mapAttribute(Object value) {
-        if (value == null)
+        if (value == null){
             return Optional.absent();
+        }
 
         String expectedClass = getOpenType().getClassName();
         String realClass = value.getClass().getName();
index d92b7c4..7dbf4f4 100644 (file)
@@ -25,8 +25,9 @@ public class SimpleAttributeMappingStrategy extends AbstractAttributeMappingStra
 
     @Override
     public Optional<String> mapAttribute(Object value) {
-        if (value == null)
+        if (value == null){
             return Optional.absent();
+        }
 
         String expectedClass = getOpenType().getClassName();
         String realClass = value.getClass().getName();
index 81a1e53..1754fc7 100644 (file)
@@ -26,9 +26,9 @@ public class UnionCompositeAttributeMappingStrategy extends
 
     @Override
     protected Optional<?> mapInnerAttribute(CompositeDataSupport compositeData, String jmxName, String description) {
-        if(description.equals(JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION) == false)
+        if(!description.equals(JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION)){
             return Optional.absent();
-
+        }
         return super.mapInnerAttribute(compositeData, jmxName, description);
     }
 }
index adee8be..f0d7960 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.resolving;
 
 import com.google.common.base.Optional;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.confignetconfconnector.util.Util;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -33,7 +34,7 @@ final class ArrayAttributeResolvingStrategy extends AbstractAttributeResolvingSt
     }
 
     @Override
-    public Optional<Object> parseAttribute(String attrName, Object value) {
+    public Optional<Object> parseAttribute(String attrName, Object value) throws NetconfDocumentedException {
         if (value == null) {
             return Optional.absent();
         }
@@ -45,31 +46,31 @@ final class ArrayAttributeResolvingStrategy extends AbstractAttributeResolvingSt
 
         if (innerTypeResolvingStrategy.getOpenType() instanceof CompositeType) {
             innerTypeClass = CompositeDataSupport.class;
-        } else
+        } else {
             try {
                 innerTypeClass = Class.forName(getOpenType().getElementOpenType().getClassName());
             } catch (ClassNotFoundException e) {
-                throw new RuntimeException("Unable to locate class for "
+                throw new IllegalStateException("Unable to locate class for "
                         + getOpenType().getElementOpenType().getClassName(), e);
             }
+        }
 
         Object parsedArray = null;
 
         if (getOpenType().isPrimitiveArray()) {
             Class<?> primitiveType = getPrimitiveType(innerTypeClass);
             parsedArray = Array.newInstance(primitiveType, valueList.size());
-        } else
+        } else {
             parsedArray = Array.newInstance(innerTypeClass, valueList.size());
+        }
 
         int i = 0;
         for (Object innerValue : valueList) {
             Optional<?> parsedElement = innerTypeResolvingStrategy.parseAttribute(attrName + "_" + i, innerValue);
-
-            if (!parsedElement.isPresent())
+            if (!parsedElement.isPresent()){
                 continue;
-
+            }
             Array.set(parsedArray, i, parsedElement.get());
-            // parsedArray[i] = parsedElement.get();
             i++;
         }
 
@@ -94,7 +95,7 @@ final class ArrayAttributeResolvingStrategy extends AbstractAttributeResolvingSt
         try {
             return (Class<?>) innerTypeClass.getField("TYPE").get(null);
         } catch (Exception e) {
-            throw new RuntimeException("Unable to determine primitive type to " + innerTypeClass);
+            throw new IllegalStateException("Unable to determine primitive type to " + innerTypeClass);
         }
     }
 
index 0bb274a..599d813 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attri
 import com.google.common.base.Optional;
 
 import javax.management.openmbean.OpenType;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 
 /**
  * Create real object from String or Map that corresponds to given opentype.
@@ -18,5 +19,5 @@ import javax.management.openmbean.OpenType;
 public interface AttributeResolvingStrategy<T, O extends OpenType<?>> {
     O getOpenType();
 
-    Optional<T> parseAttribute(String attrName, Object value);
+    Optional<T> parseAttribute(String attrName, Object value) throws NetconfDocumentedException;
 }
index e8e97f9..83ebf65 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attri
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Maps;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.confignetconfconnector.util.Util;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -41,7 +42,7 @@ class CompositeAttributeResolvingStrategy extends
     }
 
     @Override
-    public Optional<CompositeDataSupport> parseAttribute(String attrName, Object value) {
+    public Optional<CompositeDataSupport> parseAttribute(String attrName, Object value) throws NetconfDocumentedException {
 
         if (value == null) {
             return Optional.absent();
@@ -75,7 +76,7 @@ class CompositeAttributeResolvingStrategy extends
         try {
             parsedValue = new CompositeDataSupport(getOpenType(), items);
         } catch (OpenDataException e) {
-            throw new RuntimeException("An error occured during restoration of composite type " + this
+            throw new IllegalStateException("An error occured during restoration of composite type " + this
                     + " for attribute " + attrName + " from value " + value, e);
         }
 
index 82c8c1e..4a4281a 100644 (file)
@@ -106,8 +106,8 @@ public class ObjectResolver extends AttributeIfcSwitchStatement<AttributeResolvi
 
     @Override
     protected AttributeResolvingStrategy<?, ? extends OpenType<?>> caseTOAttribute(CompositeType openType) {
-        Preconditions.checkState(lastAttribute instanceof TOAttribute);
-        TOAttribute toAttribute = (TOAttribute) lastAttribute;
+        Preconditions.checkState(getLastAttribute() instanceof TOAttribute);
+        TOAttribute toAttribute = (TOAttribute) getLastAttribute();
 
         Map<String, AttributeResolvingStrategy<?, ? extends OpenType<?>>> innerMap = Maps.newHashMap();
 
@@ -122,14 +122,14 @@ public class ObjectResolver extends AttributeIfcSwitchStatement<AttributeResolvi
 
     @Override
     protected AttributeResolvingStrategy<?, ? extends OpenType<?>> caseListAttribute(ArrayType<?> openType) {
-        Preconditions.checkState(lastAttribute instanceof ListAttribute);
-        AttributeIfc innerAttribute = ((ListAttribute) lastAttribute).getInnerAttribute();
+        Preconditions.checkState(getLastAttribute() instanceof ListAttribute);
+        AttributeIfc innerAttribute = ((ListAttribute) getLastAttribute()).getInnerAttribute();
         return new ArrayAttributeResolvingStrategy(prepareStrategy(innerAttribute), openType);
     }
 
     @Override
     protected AttributeResolvingStrategy<?, ? extends OpenType<?>> caseListDependeciesAttribute(ArrayType<?> openType) {
-        Preconditions.checkState(lastAttribute instanceof ListDependenciesAttribute);
+        Preconditions.checkState(getLastAttribute() instanceof ListDependenciesAttribute);
         return new ArrayAttributeResolvingStrategy(caseDependencyAttribute(SimpleType.OBJECTNAME), openType);
     }
 
index e1b8ecf..26709db 100644 (file)
@@ -10,6 +10,9 @@ package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attri
 
 import com.google.common.base.Optional;
 import com.google.common.collect.Maps;
+import java.lang.reflect.InvocationTargetException;
+import java.text.ParseException;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.confignetconfconnector.util.Util;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -35,7 +38,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS
     }
 
     @Override
-    public Optional<Object> parseAttribute(String attrName, Object value) {
+    public Optional<Object> parseAttribute(String attrName, Object value) throws NetconfDocumentedException {
         if (value == null) {
             return Optional.absent();
         }
@@ -70,32 +73,42 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS
     }
 
     static interface Resolver {
-        Object resolveObject(Class<?> type, String attrName, String value);
+        Object resolveObject(Class<?> type, String attrName, String value) throws NetconfDocumentedException;
     }
 
     static class DefaultResolver implements Resolver {
 
         @Override
-        public Object resolveObject(Class<?> type, String attrName, String value) {
+        public Object resolveObject(Class<?> type, String attrName, String value) throws NetconfDocumentedException {
             try {
-                Object parsedValue = parseObject(type, value);
-                return parsedValue;
+                return parseObject(type, value);
             } catch (Exception e) {
-                throw new RuntimeException("Unable to resolve attribute " + attrName + " from " + value, e);
+                throw new NetconfDocumentedException("Unable to resolve attribute " + attrName + " from " + value,
+                        NetconfDocumentedException.ErrorType.application,
+                        NetconfDocumentedException.ErrorTag.operation_failed,
+                        NetconfDocumentedException.ErrorSeverity.error);
             }
         }
 
-        protected Object parseObject(Class<?> type, String value) throws Exception {
-            Method method = type.getMethod("valueOf", String.class);
-            Object parsedValue = method.invoke(null, value);
-            return parsedValue;
+        protected Object parseObject(Class<?> type, String value) throws NetconfDocumentedException {
+            Method method = null;
+            try {
+                method = type.getMethod("valueOf", String.class);
+                return method.invoke(null, value);
+            } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+                logger.trace("Error parsing object {}",e);
+                throw new NetconfDocumentedException("Error parsing object.",
+                        NetconfDocumentedException.ErrorType.application,
+                        NetconfDocumentedException.ErrorTag.operation_failed,
+                        NetconfDocumentedException.ErrorSeverity.error);
+            }
         }
     }
 
     static class StringResolver extends DefaultResolver {
 
         @Override
-        protected Object parseObject(Class<?> type, String value) throws Exception {
+        protected Object parseObject(Class<?> type, String value) {
             return value;
         }
     }
@@ -103,7 +116,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS
     static class BigIntegerResolver extends DefaultResolver {
 
         @Override
-        protected Object parseObject(Class<?> type, String value) throws Exception {
+        protected Object parseObject(Class<?> type, String value) {
             return new BigInteger(value);
         }
     }
@@ -111,7 +124,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS
     static class BigDecimalResolver extends DefaultResolver {
 
         @Override
-        protected Object parseObject(Class<?> type, String value) throws Exception {
+        protected Object parseObject(Class<?> type, String value) {
             return new BigDecimal(value);
         }
     }
@@ -119,16 +132,23 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS
     static class CharResolver extends DefaultResolver {
 
         @Override
-        protected Object parseObject(Class<?> type, String value) throws Exception {
+        protected Object parseObject(Class<?> type, String value)  {
             return new Character(value.charAt(0));
         }
     }
 
     static class DateResolver extends DefaultResolver {
-
         @Override
-        protected Object parseObject(Class<?> type, String value) throws Exception {
-            return Util.readDate(value);
+        protected Object parseObject(Class<?> type, String value) throws NetconfDocumentedException {
+            try {
+                return Util.readDate(value);
+            } catch (ParseException e) {
+                logger.trace("Unable parse value {} due to  {}",value, e);
+                throw new NetconfDocumentedException("Unable to parse value "+value+" as date.",
+                        NetconfDocumentedException.ErrorType.application,
+                        NetconfDocumentedException.ErrorTag.operation_failed,
+                        NetconfDocumentedException.ErrorSeverity.error);
+            }
         }
     }
 
index bc99ecf..cdebcfa 100644 (file)
@@ -34,10 +34,11 @@ final class UnionCompositeAttributeResolvingStrategy extends CompositeAttributeR
         Map<String, Object> newMap = Maps.newHashMap();
 
         for (String key : openType.keySet()) {
-            if (openType.getDescription(key).equals(JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION))
+            if (openType.getDescription(key).equals(JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION)){
                 newMap.put(key, valueMap.get(JavaAttribute.DESCRIPTION_OF_VALUE_ATTRIBUTE_FOR_UNION));
-            else
+            } else {
&n