Update MRI projects for Aluminium 98/89498/40
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 28 Apr 2020 17:23:50 +0000 (19:23 +0200)
committerSomashekhar Javalagi <somashekhar.manohara.javalagi@ericsson.com>
Tue, 26 May 2020 08:17:19 +0000 (13:47 +0530)
This bumps versions to the following:
- odlparent-7.0.1
- yangtools-5.0.1
- mdsal-6.0.0
- controller-2.0.0

Change-Id: I4f23c953622f39186f82ac1da487f00f3a9707ab
Signed-off-by: Somashekhar Javalagi <somashekhar.manohara.javalagi@ericsson.com>
239 files changed:
applications/arbitratorreconciliation/pom.xml
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterConcurrent.java
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterDirectOFRpc.java
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterSequential.java
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterTxChain.java
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/TableWriter.java
applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterConcurrentTest.java
applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterDirectOFRpcTest.java
applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterSequentialTest.java
applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterTxChainTest.java
applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImplTest.java
applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/TableWriterTest.java
applications/forwardingrules-manager/pom.xml
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowForwarder.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeReconciliationImpl.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/GroupForwarder.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/MeterForwarder.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/util/FrmUtil.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListener.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/SyncReactorImpl.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyFlatBatchImpl.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/util/FlowCapableNodeLookups.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/util/ReconcileUtil.java
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/DSInputFactory.java
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListenerTest.java
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/TableForwarderTest.java
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/util/ReconcileUtilTest.java
applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/NodeConnectorStatNotificationSupplierImplTest.java
applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/impl/item/stat/QueueStatNotificationSupplierImplTest.java
applications/pom.xml
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/ReconciliationServiceImpl.java
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/ReconciliationCount.java
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/util/ShellUtil.java
applications/table-miss-enforcer/src/test/java/org/opendaylight/openflowplugin/applications/tablemissenforcer/LLDPDataTreeChangeListenerTest.java
applications/topology-lldp-discovery/src/main/java/org/opendaylight/openflowplugin/applications/topology/lldp/utils/LLDPDiscoveryUtils.java
applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/TopologyManagerUtil.java
applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/FlowCapableTopologyExporterTest.java
applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/NodeChangeListenerImplTest.java
applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/TerminationPointChangeListenerImplTest.java
applications/topology-manager/src/test/java/org/opendaylight/openflowplugin/applications/topology/manager/TestUtils.java
artifacts/pom.xml
distribution/karaf/pom.xml
extension/features-extension-aggregator/features-openflowplugin-extension/pom.xml
extension/features-extension-aggregator/odl-openflowplugin-eric-extensions/pom.xml
extension/features-extension-aggregator/odl-openflowplugin-nxm-extensions/pom.xml
extension/features-extension-aggregator/odl-openflowplugin-onf-extensions/pom.xml
extension/features-extension-aggregator/pom.xml
extension/openflowplugin-extension-api/src/test/java/org/opendaylight/openflowplugin/extension/api/GroupingLooseResolverTest.java
extension/openflowplugin-extension-api/src/test/java/org/opendaylight/openflowplugin/extension/api/GroupingResolverTest.java
extension/openflowplugin-extension-api/src/test/java/org/opendaylight/openflowplugin/extension/api/SetFieldExtensionTest.java
extension/openflowplugin-extension-eric/src/test/java/org/opendaylight/openflowplugin/extension/vendor/eric/convertor/match/Icmpv6NDOptionsTypeConvertorTest.java
extension/openflowplugin-extension-eric/src/test/java/org/opendaylight/openflowplugin/extension/vendor/eric/convertor/match/Icmpv6NDReservedConvertorTest.java
extension/openflowplugin-extension-onf/src/main/java/org/opendaylight/openflowplugin/extension/onf/converter/BundleAddMessageConverter.java
extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/converter/BundleAddMessageConverterTest.java
extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/converter/BundleControlConverterTest.java
extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/deserializer/BundleControlFactoryTest.java
extension/pom.xml
features-aggregator/features-openflowplugin/pom.xml
features-aggregator/odl-openflowplugin-app-arbitratorreconciliation/pom.xml
features-aggregator/odl-openflowplugin-app-bulk-o-matic/pom.xml
features-aggregator/odl-openflowplugin-app-config-pusher/pom.xml
features-aggregator/odl-openflowplugin-app-forwardingrules-manager/pom.xml
features-aggregator/odl-openflowplugin-app-forwardingrules-sync/pom.xml
features-aggregator/odl-openflowplugin-app-lldp-speaker/pom.xml
features-aggregator/odl-openflowplugin-app-notifications/pom.xml
features-aggregator/odl-openflowplugin-app-reconciliation-framework/pom.xml
features-aggregator/odl-openflowplugin-app-southbound-cli/pom.xml
features-aggregator/odl-openflowplugin-app-table-miss-enforcer/pom.xml
features-aggregator/odl-openflowplugin-app-topology-lldp-discovery/pom.xml
features-aggregator/odl-openflowplugin-app-topology-manager/pom.xml
features-aggregator/odl-openflowplugin-app-topology/pom.xml
features-aggregator/odl-openflowplugin-drop-test/pom.xml
features-aggregator/odl-openflowplugin-flow-services-rest/pom.xml
features-aggregator/odl-openflowplugin-flow-services/pom.xml
features-aggregator/odl-openflowplugin-libraries/pom.xml
features-aggregator/odl-openflowplugin-libraries/src/main/feature/feature.xml
features-aggregator/odl-openflowplugin-nsf-model/pom.xml
features-aggregator/odl-openflowplugin-southbound/pom.xml
features-aggregator/pom.xml
libraries/liblldp/pom.xml
libraries/pom.xml
model/pom.xml
openflowjava/features-openflowjava-aggregator/features-openflowjava/pom.xml
openflowjava/features-openflowjava-aggregator/odl-openflowjava-protocol/pom.xml
openflowjava/features-openflowjava-aggregator/pom.xml
openflowjava/openflow-protocol-api/src/main/yang/openflow-instruction.yang
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/HelloMessageFactoryTest.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10FeaturesReplyMessageFactoryTest.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyFlowTest.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyPortDescTest.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/multipart/MultipartReplyTableFeaturesTest.java
openflowplugin-common/src/main/java/org/opendaylight/openflowplugin/common/txchain/TransactionChainManager.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/datastore/multipart/FlowStatsMultipartWriter.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/datastore/multipart/GroupDescMultipartWriter.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/datastore/multipart/GroupStatsMultipartWriter.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/datastore/multipart/MeterConfigMultipartWriter.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/datastore/multipart/MeterStatsMultipartWriter.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/datastore/multipart/PortStatsMultipartWriter.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/datastore/multipart/QueueStatsMultipartWriter.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/datastore/multipart/TableFeaturesMultipartWriter.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/datastore/multipart/TableStatsMultipartWriter.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/lifecycle/ContextChainHolderImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/messages/MeterMessageDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyFlowStatsDeserializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/instructions/AbstractActionInstructionSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/match/MatchSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/messages/FlowMessageSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/messages/GroupMessageSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/messages/MeterMessageSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/MultipartRequestTableFeaturesSerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/ApplyActionsMissTablePropertySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/ApplyActionsTablePropertySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/ApplySetfieldMissTablePropertySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/ApplySetfieldTablePropertySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/InstructionsMissTablePropertySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/InstructionsTablePropertySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/MatchTablePropertySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/WildcardsTablePropertySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/WriteActionsMissTablePropertySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/WriteActionsTablePropertySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/WriteSetfieldMissTablePropertySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/protocol/serialization/multipart/tablefeatures/WriteSetfieldTablePropertySerializer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/registry/flow/DeviceFlowRegistryImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactory.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractRequestCallback.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/batch/FlatBatchFlowAdapters.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/batch/FlatBatchGroupAdapters.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/batch/FlatBatchMeterAdapters.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlatBatchServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowsBatchServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalGroupsBatchServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalMetersBatchServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalPortServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerTableMultipartService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtils.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/MessageIntelligenceAgencyImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/AllMeterConfigStatsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/GroupDescriptionService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/GroupStatisticsToNotificationTransformer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/MeterStatisticsToNotificationTransformer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/NodeConnectorStatisticsToNotificationTransformer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/QueueStatisticsToNotificationTransformer.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/FlowDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/GroupDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/MeterDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/PortDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/QueueDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/PacketReceivedTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/AddressNormalizationUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/FlatBatchUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/FlowUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/MatchUtil.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManagerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/instruction/ApplyActionsInstructionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/instruction/WriteActionsInstructionDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/messages/FlowMessageDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/messages/GroupMessageDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/messages/MeterMessageDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyFlowStatsDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyFlowTableStatsDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyGroupDescDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyGroupStatsDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyMessageDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyMeterConfigDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyMeterStatsDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyPortStatsDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyQueueStatsDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/deserialization/multipart/MultipartReplyTableFeaturesDeserializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/serialization/messages/FlowMessageSerializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/protocol/serialization/messages/MeterMessageSerializerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/DeviceFlowRegistryImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactoryTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/registry/flow/TestFlowHelper.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/batch/FlatBatchFlowAdaptersTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/batch/FlatBatchGroupAdaptersTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/batch/FlatBatchMeterAdaptersTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalExperimenterMpMessageServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlatBatchServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowsBatchServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalGroupsBatchServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/sal/SalMetersBatchServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/singlelayer/SingleLayerTableMultipartServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/MultipartReplyTranslatorTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/FlowDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/GroupDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/MeterDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/NodeConnectorDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/multilayer/QueueDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/FlowDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/GroupDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/MeterDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/NodeConnectorDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/singlelayer/QueueDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/PortUpdateTranslatorTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/FlatBatchUtilTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/FlowUtilTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/GroupUtilTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MeterUtilTest.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/extension/MatchExtensionHelper.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/ConvertorExecutor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/ConvertorManager.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/GroupConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/GroupDescStatsResponseConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/GroupStatsResponseConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/MeterConfigStatsResponseConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/MeterConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/MeterStatsResponseConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/PacketOutConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/TableFeaturesConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/ActionConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/FlowConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/FlowStatsResponseConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchResponseConvertor.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/extension/MatchExtensionHelperTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/GroupConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/GroupDescStatsResponseConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/GroupStatsResponseConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/MeterConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/MeterStatsResponseConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/PacketOutConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/TableFeaturesConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/TableFeaturesResponseConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/FlowConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchResponseConvertor2Test.java
parent/pom.xml
samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/FlowCommitWrapperImpl.java
samples/pom.xml
samples/simple-client/pom.xml
test-common/src/main/java/org/opendaylight/openflowplugin/testcommon/DropTestCommiter.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkGroupTransactionProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkTransactionProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestCommandProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestCommandProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginStatsTestCommandProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestCommandProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestCommandProvider.java

index ee63977225880810a603be214d891c5ff567e13b..58fb10a3605cc5a985991143b99d99b0b46f635a 100644 (file)
@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index ae73a6248c50511a17d2db11cc2c08246b261557..1cca45eaf2120d6bac17ad398b8301a32cff6c3e 100644 (file)
@@ -150,7 +150,11 @@ public class FlowWriterConcurrent implements FlowCounterMBean {
                 Flow flow, Integer sourceIp, Short tableId) {
             if (add) {
                 LOG.trace("Adding flow for flowId: {}, flowIid: {}", flowId, flowIid);
-                writeTransaction.put(LogicalDatastoreType.CONFIGURATION, flowIid, flow, isCreateParents);
+                if (isCreateParents) {
+                    writeTransaction.mergeParentStructurePut(LogicalDatastoreType.CONFIGURATION, flowIid, flow);
+                } else {
+                    writeTransaction.put(LogicalDatastoreType.CONFIGURATION, flowIid, flow);
+                }
             } else {
                 LOG.trace("Deleting flow for flowId: {}, flowIid: {}", flowId, flowIid);
                 writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, flowIid);
index 02bc9bd88cf7bae8e72577db2ccd1f325c1b8544..7755fcf44cb1ab83536dccbffbb657b57bcfa7b0 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.openflowplugin.applications.bulk.o.matic;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.ExecutionException;
@@ -77,8 +77,8 @@ public class FlowWriterDirectOFRpc {
         try (ReadTransaction readOnlyTransaction = dataBroker.newReadOnlyTransaction()) {
             Optional<Nodes> nodesDataNode = readOnlyTransaction.read(LogicalDatastoreType.OPERATIONAL, nodes).get();
             if (nodesDataNode.isPresent()) {
-                List<Node> nodesCollection = nodesDataNode.get().getNode();
-                if (nodesCollection != null && !nodesCollection.isEmpty()) {
+                Collection<Node> nodesCollection = nodesDataNode.get().nonnullNode().values();
+                if (!nodesCollection.isEmpty()) {
                     for (Node node : nodesCollection) {
                         LOG.info("Switch with ID {} discovered !!", node.getId().getValue());
                         nodeIds.add(node.getId().getValue());
index 7a319c5b5fdcdad0caa447fa3c7dc2da7498a1ee..987d73de6e928513ba13fccbdc076cd8a1d1761b 100644 (file)
@@ -140,7 +140,11 @@ public class FlowWriterSequential implements FlowCounterMBean {
                 Flow flow) {
             if (add) {
                 LOG.trace("Adding flow for flowId: {}, flowIid: {}", flowId, flowIid);
-                writeTransaction.put(LogicalDatastoreType.CONFIGURATION, flowIid, flow, isCreateParents);
+                if (isCreateParents) {
+                    writeTransaction.mergeParentStructurePut(LogicalDatastoreType.CONFIGURATION, flowIid, flow);
+                } else {
+                    writeTransaction.put(LogicalDatastoreType.CONFIGURATION, flowIid, flow);
+                }
             } else {
                 LOG.trace("Deleting flow for flowId: {}, flowIid: {}", flowId, flowIid);
                 writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, flowIid);
index b6e0b2664e0d5abd5006333f8b76fb671ed62cb4..9f7a7024ab8cfe4b3f303c51b07719c1a6cee64d 100644 (file)
@@ -176,7 +176,11 @@ public class FlowWriterTxChain implements FlowCounterMBean {
                 Flow flow, Integer sourceIp, Short tableId) {
             if (add) {
                 LOG.trace("Adding flow for flowId: {}, flowIid: {}", flowId, flowIid);
-                writeTransaction.put(LogicalDatastoreType.CONFIGURATION, flowIid, flow, isCreateParents);
+                if (isCreateParents) {
+                    writeTransaction.mergeParentStructurePut(LogicalDatastoreType.CONFIGURATION, flowIid, flow);
+                } else {
+                    writeTransaction.put(LogicalDatastoreType.CONFIGURATION, flowIid, flow);
+                }
             } else {
                 LOG.trace("Deleting flow for flowId: {}, flowIid: {}", flowId, flowIid);
                 writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, flowIid);
index 9a238dc03ead7c0f48e72abdfe109f283e8f0e7c..48356e0891e11d44b2088ee5f7a22836212143b5 100644 (file)
@@ -28,7 +28,6 @@ import javax.management.MBeanServer;
 import javax.management.MalformedObjectNameException;
 import javax.management.NotCompliantMBeanException;
 import javax.management.ObjectName;
-
 import org.opendaylight.infrautils.utils.concurrent.LoggingFutures;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.api.WriteTransaction;
@@ -106,8 +105,14 @@ public class SalBulkFlowServiceImpl implements SalBulkFlowService {
             FlowBuilder flowBuilder = new FlowBuilder(bulkFlow);
             flowBuilder.setTableId(bulkFlow.getTableId());
             flowBuilder.setId(new FlowId(bulkFlow.getFlowId()));
-            writeTransaction.put(LogicalDatastoreType.CONFIGURATION, getFlowInstanceIdentifier(bulkFlow),
-                    flowBuilder.build(), createParents);
+            if (createParents) {
+                writeTransaction.mergeParentStructurePut(LogicalDatastoreType.CONFIGURATION,
+                        getFlowInstanceIdentifier(bulkFlow),
+                        flowBuilder.build());
+            } else {
+                writeTransaction.put(LogicalDatastoreType.CONFIGURATION, getFlowInstanceIdentifier(bulkFlow),
+                        flowBuilder.build());
+            }
             createParents = createParentsNextTime;
         }
         FluentFuture<?> submitFuture = writeTransaction.commit();
index 54f7906b970b6fe80122657d6007afdb1c70e61c..1e2bc3a5a0ab864d670c7c38af4ed1dd63becd3b 100644 (file)
@@ -91,7 +91,7 @@ public class TableWriter implements FlowCounterMBean {
                     InstanceIdentifier<Table> tableIId = BulkOMaticUtils.getTableId(tableId, dpId);
 
                     if (isAdd) {
-                        wtx.put(LogicalDatastoreType.CONFIGURATION, tableIId, table, true);
+                        wtx.mergeParentStructurePut(LogicalDatastoreType.CONFIGURATION, tableIId, table);
                     } else {
                         wtx.delete(LogicalDatastoreType.CONFIGURATION, tableIId);
                     }
index 7b41b34f25c336b105e42a9c5de34985f3a538a8..b3f4be40babf0f92245271138a23a530b0108600 100644 (file)
@@ -59,9 +59,8 @@ public class FlowWriterConcurrentTest {
     @Test
     public void testAddFlows() {
         flowWriterConcurrent.addFlows(1, FLOWS_PER_DPN, 10, 10, 10, (short) 0, (short) 1, true);
-        Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).put(ArgumentMatchers.any(),
-                ArgumentMatchers.any(), ArgumentMatchers.any(),
-                ArgumentMatchers.anyBoolean());
+        Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).mergeParentStructurePut(ArgumentMatchers.any(),
+                ArgumentMatchers.any(), ArgumentMatchers.any());
     }
 
     @Test
index 53d007f75f9de5e2a8a8219c73d618eea1efeb64..2de02cdce88b1c8996f884819146b8da35b92fa2 100644 (file)
@@ -11,8 +11,8 @@ import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.when;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Optional;
 import java.util.concurrent.ExecutorService;
 import org.junit.Before;
@@ -30,6 +30,7 @@ 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.util.concurrent.FluentFutures;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
@@ -65,11 +66,11 @@ public class FlowWriterDirectOFRpcTest {
         NodeBuilder nodeBuilder = new NodeBuilder()
                 .setId(new NodeId("1"));
 
-        final List<Node> nodes = new ArrayList<>();
+        final Map<NodeKey, Node> nodes = new HashMap<>();
         final Node node = nodeBuilder.build();
-        nodes.add(node);
+        nodes.put(node.key(), node);
 
-        when(mockNodes.getNode()).thenReturn(nodes);
+        when(mockNodes.nonnullNode()).thenReturn(nodes);
 
         doReturn(FluentFutures.immediateFluentFuture(Optional.of(mockNodes))).when(readOnlyTransaction)
             .read(any(LogicalDatastoreType.class), any());
index d6fcf0fe76c9009bfec7e6b462a3c9bfb43f7381..f9c510df33d66ff7e8d6330cbb9fefb97e2f26c2 100644 (file)
@@ -57,9 +57,8 @@ public class FlowWriterSequentialTest {
     @Test
     public void testAddFlows() {
         flowWriterSequential.addFlows(1, FLOWS_PER_DPN, 10, 10, (short) 0, (short) 1, true);
-        Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).put(ArgumentMatchers.any(),
-                ArgumentMatchers.any(), ArgumentMatchers.any(),
-                ArgumentMatchers.anyBoolean());
+        Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).mergeParentStructurePut(ArgumentMatchers.any(),
+                ArgumentMatchers.any(), ArgumentMatchers.any());
     }
 
     @Test
index 6a1ec183f2bedf0f63bab364bec75aa4380ff8af..5ed37cb015852148ed74677fb77f403397298dfd 100644 (file)
@@ -64,9 +64,8 @@ public class FlowWriterTxChainTest {
     @Test
     public void testAddFlows() {
         flowWriterTxChain.addFlows(1, FLOWS_PER_DPN, 10, 10, 10, (short) 0, (short) 1, true);
-        Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).put(ArgumentMatchers.any(),
-                ArgumentMatchers.any(), ArgumentMatchers.any(),
-                ArgumentMatchers.anyBoolean());
+        Mockito.verify(writeTransaction, Mockito.times(FLOWS_PER_DPN)).mergeParentStructurePut(ArgumentMatchers.any(),
+                ArgumentMatchers.any(), ArgumentMatchers.any());
     }
 
     @Test
index 254515d5de63eb36c5ce3c1726b9e7d484014947..f2935470757f32bc2caf4b550ee2052085d3bab3 100644 (file)
@@ -125,8 +125,8 @@ public class SalBulkFlowServiceImplTest {
         salBulkFlowService.addFlowsDs(addFlowsDsInput);
 
         verify(writeTransaction).commit();
-        verify(writeTransaction).put(ArgumentMatchers.any(), ArgumentMatchers.any(),
-                flowArgumentCaptor.capture(), Mockito.anyBoolean());
+        verify(writeTransaction).mergeParentStructurePut(ArgumentMatchers.any(), ArgumentMatchers.any(),
+                flowArgumentCaptor.capture());
 
         Flow flow = flowArgumentCaptor.getValue();
         Assert.assertEquals("1", flow.getId().getValue());
index 9294e6076985cdf9f88d1655f3f12614d002168c..6d359a555e808a0a32abb81b95ffcc1087078d98 100644 (file)
@@ -60,9 +60,8 @@ public class TableWriterTest {
     public void testAddTables() {
         tableWriter.addTables(DPN_COUNT, START_TABLE_ID, END_TABLE_ID);
         Mockito.verify(writeTransaction, Mockito.times(TABLES_PER_DPN))
-                .put(ArgumentMatchers.any(),
-                        ArgumentMatchers.any(), ArgumentMatchers.any(),
-                        ArgumentMatchers.anyBoolean());
+                .mergeParentStructurePut(ArgumentMatchers.any(),
+                        ArgumentMatchers.any(), ArgumentMatchers.any());
     }
 
     @Test
index 0836f2f497a86c2d75e3dafc8997d64709a08fff..4f2ea62f242b378352bc88154bb589de463a035e 100644 (file)
       <artifactId>blueprint-maven-plugin-annotation</artifactId>
       <optional>true</optional>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal</groupId>
+      <artifactId>mdsal-binding-runtime-spi</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal</groupId>
+      <artifactId>mdsal-binding-generator-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
index b8cc16736ac3d0692846e4db5735e8cba16b4aca..cd4219f437cf04ec319e637cbf5ec48ab6d55bbe 100644 (file)
@@ -305,7 +305,7 @@ public class FlowForwarder extends AbstractListeningCommiter<Flow> {
     private void persistStaleFlow(StaleFlow staleFlow, InstanceIdentifier<FlowCapableNode> nodeIdent) {
         WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
         writeTransaction.put(LogicalDatastoreType.CONFIGURATION, getStaleFlowInstanceIdentifier(staleFlow, nodeIdent),
-                staleFlow, false);
+                staleFlow);
 
         FluentFuture<?> submitFuture = writeTransaction.commit();
         handleStaleFlowResultFuture(submitFuture);
index 5976cbb3533b5d39ff31804311cd462bd2688467..9859e9cce40b263e68e66c978f67a074652b60f8 100644 (file)
@@ -278,8 +278,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                         }, service);
 
                 /* Bundles not supported for meters */
-                List<Meter> meters = flowNode.get().getMeter() != null ? flowNode.get().getMeter()
-                        : Collections.emptyList();
+                Collection<Meter> meters = flowNode.get().nonnullMeter().values();
                 Futures.transformAsync(commitBundleFuture,
                     rpcResult -> {
                         if (rpcResult.isSuccessful()) {
@@ -384,9 +383,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                 //put the dpn info into the map
                 reconciliationStates.put(dpnId.toString(), reconciliationState);
                 LOG.debug("Triggering reconciliation for node {} with state: {}", dpnId, STARTED);
-                List<TableFeatures> tableList = flowNode.get().getTableFeatures() != null
-                        ? flowNode.get().getTableFeatures()
-                        : Collections.<TableFeatures>emptyList();
+                Collection<TableFeatures> tableList = flowNode.get().nonnullTableFeatures().values();
                 for (TableFeatures tableFeaturesItem : tableList) {
                     TableFeaturesKey tableKey = tableFeaturesItem.key();
                     KeyedInstanceIdentifier<TableFeatures, TableFeaturesKey> tableFeaturesII = nodeIdentity
@@ -395,8 +392,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                 }
 
                 /* Groups - have to be first */
-                List<Group> groups = flowNode.get().getGroup() != null ? flowNode.get().getGroup()
-                        : Collections.<Group>emptyList();
+                Collection<Group> groups = flowNode.get().nonnullGroup().values();
                 List<Group> toBeInstalledGroups = new ArrayList<>();
                 toBeInstalledGroups.addAll(groups);
                 // new list for suspected groups pointing to ports .. when the ports come up
@@ -420,12 +416,12 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                         Group group = iterator.next();
                         boolean okToInstall = true;
                         Buckets buckets = group.getBuckets();
-                        List<Bucket> bucketList = buckets == null ? null : buckets.getBucket();
+                        Collection<Bucket> bucketList = buckets == null ? null : buckets.nonnullBucket().values();
                         if (bucketList == null) {
                             bucketList = Collections.<Bucket>emptyList();
                         }
                         for (Bucket bucket : bucketList) {
-                            List<Action> actions = bucket.getAction();
+                            Collection<Action> actions = bucket.nonnullAction().values();
                             if (actions == null) {
                                 actions = Collections.<Action>emptyList();
                             }
@@ -497,8 +493,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                     }
                 }
                 /* Meters */
-                List<Meter> meters = flowNode.get().getMeter() != null ? flowNode.get().getMeter()
-                        : Collections.<Meter>emptyList();
+                Collection<Meter> meters = flowNode.get().nonnullMeter().values();
                 for (Meter meter : meters) {
                     final KeyedInstanceIdentifier<Meter, MeterKey> meterIdent = nodeIdentity.child(Meter.class,
                             meter.key());
@@ -510,13 +505,13 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                 awaitGroups(node, groupFutures.values());
 
                 /* Flows */
-                List<Table> tables = flowNode.get().getTable() != null ? flowNode.get().getTable()
+                Collection<Table> tables = flowNode.get().getTable() != null ? flowNode.get().nonnullTable().values()
                         : Collections.<Table>emptyList();
                 int flowCount = 0;
                 for (Table table : tables) {
                     final KeyedInstanceIdentifier<Table, TableKey> tableIdent = nodeIdentity.child(Table.class,
                             table.key());
-                    List<Flow> flows = table.getFlow() != null ? table.getFlow() : Collections.<Flow>emptyList();
+                    Collection<Flow> flows = table.nonnullFlow().values();
                     flowCount += flows.size();
                     for (Flow flow : flows) {
                         final KeyedInstanceIdentifier<Flow, FlowKey> flowIdent = tableIdent.child(Flow.class,
@@ -624,13 +619,11 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
             LOG.debug("Proceeding with deletion of stale-marked Flows on switch {} using Openflow interface",
                     nodeIdent);
             /* Stale-Flows - Stale-marked Flows have to be removed first for safety */
-            List<Table> tables = flowNode.get().getTable() != null ? flowNode.get().getTable()
-                    : Collections.<Table>emptyList();
+            Collection<Table> tables = flowNode.get().nonnullTable().values();
             for (Table table : tables) {
                 final KeyedInstanceIdentifier<Table, TableKey> tableIdent = nodeIdent.child(Table.class,
                         table.key());
-                List<StaleFlow> staleFlows = table.getStaleFlow() != null ? table.getStaleFlow()
-                        : Collections.<StaleFlow>emptyList();
+                Collection<StaleFlow> staleFlows = table.nonnullStaleFlow().values();
                 for (StaleFlow staleFlow : staleFlows) {
 
                     FlowBuilder flowBuilder = new FlowBuilder(staleFlow);
@@ -653,8 +646,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
             // before attempting to delete groups - just in case there are references
 
             /* Stale-marked Groups - Can be deleted after flows */
-            List<StaleGroup> staleGroups = flowNode.get().getStaleGroup() != null ? flowNode.get().getStaleGroup()
-                    : Collections.<StaleGroup>emptyList();
+            Collection<StaleGroup> staleGroups = flowNode.get().nonnullStaleGroup().values();
             for (StaleGroup staleGroup : staleGroups) {
 
                 GroupBuilder groupBuilder = new GroupBuilder(staleGroup);
@@ -671,8 +663,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
             LOG.debug("Proceeding with deletion of stale-marked Meters for switch {} using Openflow interface",
                     nodeIdent);
             /* Stale-marked Meters - can be deleted anytime - so least priority */
-            List<StaleMeter> staleMeters = flowNode.get().getStaleMeter() != null ? flowNode.get().getStaleMeter()
-                    : Collections.<StaleMeter>emptyList();
+            Collection<StaleMeter> staleMeters = flowNode.get().getStaleMeter().values();
 
             for (StaleMeter staleMeter : staleMeters) {
 
@@ -756,14 +747,14 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
                                                          final BundleId bundleIdValue,
                                                          final InstanceIdentifier<FlowCapableNode> nodeIdentity) {
         List<ListenableFuture<RpcResult<AddBundleMessagesOutput>>> futureList = new ArrayList<>();
-        for (Group group : flowNode.nonnullGroup()) {
+        for (Group group : flowNode.nonnullGroup().values()) {
             final KeyedInstanceIdentifier<Group, GroupKey> groupIdent = nodeIdentity.child(Group.class, group.key());
             futureList.add(provider.getBundleGroupListener().add(groupIdent, group, nodeIdentity, bundleIdValue));
         }
 
-        for (Table table : flowNode.nonnullTable()) {
+        for (Table table : flowNode.nonnullTable().values()) {
             final KeyedInstanceIdentifier<Table, TableKey> tableIdent = nodeIdentity.child(Table.class, table.key());
-            for (Flow flow : table.nonnullFlow()) {
+            for (Flow flow : table.nonnullFlow().values()) {
                 final KeyedInstanceIdentifier<Flow, FlowKey> flowIdent = tableIdent.child(Flow.class, flow.key());
                 futureList.add(provider.getBundleFlowListener().add(flowIdent, flow, nodeIdentity, bundleIdValue));
             }
index 79b12067e925f9f19dcb87d09f893023cc5f44f5..cbb28503d73d05ab35aa7b02ff5a7a17307242ec 100644 (file)
@@ -219,7 +219,7 @@ public class GroupForwarder extends AbstractListeningCommiter<Group> {
     private void persistStaleGroup(StaleGroup staleGroup, InstanceIdentifier<FlowCapableNode> nodeIdent) {
         WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
         writeTransaction.put(LogicalDatastoreType.CONFIGURATION, getStaleGroupInstanceIdentifier(staleGroup, nodeIdent),
-                staleGroup, false);
+                staleGroup);
 
         FluentFuture<?> submitFuture = writeTransaction.commit();
         handleStaleGroupResultFuture(submitFuture);
index ef8d5d7d97a411d606fdfa87fe79ed62f124eed9..09282388d4d98938413eacdc7ad12df631761978 100644 (file)
@@ -162,7 +162,7 @@ public class MeterForwarder extends AbstractListeningCommiter<Meter> {
     private void persistStaleMeter(StaleMeter staleMeter, InstanceIdentifier<FlowCapableNode> nodeIdent) {
         WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
         writeTransaction.put(LogicalDatastoreType.CONFIGURATION, getStaleMeterInstanceIdentifier(staleMeter, nodeIdent),
-                staleMeter, false);
+                staleMeter);
 
         FluentFuture<?> submitFuture = writeTransaction.commit();
         handleStaleMeterResultFuture(submitFuture);
index 6cd40cab71572d100ba3da2893f440709810b75a..c7f4cbba019c340f301d4922dcff41876e6df7a4 100644 (file)
@@ -9,8 +9,8 @@
 package org.opendaylight.openflowplugin.applications.frm.util;
 
 import java.math.BigInteger;
+import java.util.Collection;
 import java.util.Collections;
-import java.util.List;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
@@ -86,17 +86,17 @@ public final class FrmUtil {
     public static Uint32 isFlowDependentOnGroup(final Flow flow) {
         LOG.debug("Check if flow {} is dependent on group", flow);
         if (flow.getInstructions() != null) {
-            List<Instruction> instructions = flow.getInstructions().getInstruction();
+            Collection<Instruction> instructions = flow.getInstructions().nonnullInstruction().values();
             for (Instruction instruction : instructions) {
-                List<Action> actions = Collections.emptyList();
+                Collection<Action> actions = Collections.emptyList();
                 if (instruction.getInstruction().implementedInterface()
                         .equals(ActionType.APPLY_ACTION.getActionType())) {
                     actions = ((ApplyActionsCase) instruction.getInstruction())
-                            .getApplyActions().getAction();
+                            .getApplyActions().nonnullAction().values();
                 } else if (instruction.getInstruction().implementedInterface()
                         .equals(ActionType.WRITE_ACTION.getActionType())) {
                     actions = ((WriteActionsCase)instruction.getInstruction())
-                            .getWriteActions().getAction();
+                            .getWriteActions().nonnullAction().values();
                 }
                 for (Action action : actions) {
                     if (action.getAction().implementedInterface()
index 08dee38766a6fcdf1b8313684f6a50ea85d0f080..3448b160b7c655e1a26c9074c517e0ee141b3d04 100644 (file)
@@ -12,7 +12,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Collection;
 import java.util.Date;
-import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.binding.api.DataObjectModification;
@@ -32,6 +32,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.sn
 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.node.NodeConnector;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -213,7 +214,7 @@ public class SimplifiedOperationalListener extends AbstractFrmSyncListener<Node>
         if (node == null) {
             return true;
         }
-        final List<NodeConnector> nodeConnectors = node.getNodeConnector();
+        final Map<NodeConnectorKey, NodeConnector> nodeConnectors = node.getNodeConnector();
         return nodeConnectors == null || nodeConnectors.isEmpty();
     }
 
index 6b9c9523b7803397e6540fd334a0fa88b08b2699..ca965e9669f4fcac53879bfe97be7a675a302843 100644 (file)
@@ -14,6 +14,7 @@ import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -117,8 +118,8 @@ public class SyncReactorImpl implements SyncReactor {
     @VisibleForTesting
     private static List<ItemSyncBox<Group>> extractGroupsToAddOrUpdate(final NodeId nodeId,
             final FlowCapableNode flowCapableNodeConfigured, final FlowCapableNode flowCapableNodeOperational) {
-        final List<Group> groupsConfigured = ReconcileUtil.safeGroups(flowCapableNodeConfigured);
-        final List<Group> groupsOperational = ReconcileUtil.safeGroups(flowCapableNodeOperational);
+        final Collection<Group> groupsConfigured = ReconcileUtil.safeGroups(flowCapableNodeConfigured);
+        final Collection<Group> groupsOperational = ReconcileUtil.safeGroups(flowCapableNodeOperational);
         final Map<Uint32, Group> groupOperationalMap = FlowCapableNodeLookups.wrapGroupsToMap(groupsOperational);
 
         final List<Group> pendingGroups = new ArrayList<>();
@@ -131,8 +132,8 @@ public class SyncReactorImpl implements SyncReactor {
     private static ItemSyncBox<Meter> extractMetersToAddOrUpdate(final NodeId nodeId,
                                                                  final FlowCapableNode flowCapableNodeConfigured,
                                                                  final FlowCapableNode flowCapableNodeOperational) {
-        final List<Meter> metersConfigured = ReconcileUtil.safeMeters(flowCapableNodeConfigured);
-        final List<Meter> metersOperational = ReconcileUtil.safeMeters(flowCapableNodeOperational);
+        final Collection<Meter> metersConfigured = ReconcileUtil.safeMeters(flowCapableNodeConfigured);
+        final Collection<Meter> metersOperational = ReconcileUtil.safeMeters(flowCapableNodeOperational);
         final Map<MeterId, Meter> meterOperationalMap = FlowCapableNodeLookups.wrapMetersToMap(metersOperational);
 
         return ReconcileUtil.resolveMeterDiffs(nodeId, meterOperationalMap, metersConfigured, true);
@@ -141,12 +142,12 @@ public class SyncReactorImpl implements SyncReactor {
     @VisibleForTesting
     private static Map<TableKey, ItemSyncBox<Flow>> extractFlowsToAddOrUpdate(final NodeId nodeId,
             final FlowCapableNode flowCapableNodeConfigured, final FlowCapableNode flowCapableNodeOperational) {
-        final List<Table> tablesConfigured = ReconcileUtil.safeTables(flowCapableNodeConfigured);
+        final Collection<Table> tablesConfigured = ReconcileUtil.safeTables(flowCapableNodeConfigured);
         if (tablesConfigured.isEmpty()) {
             return Collections.emptyMap();
         }
 
-        final List<Table> tablesOperational = ReconcileUtil.safeTables(flowCapableNodeOperational);
+        final Collection<Table> tablesOperational = ReconcileUtil.safeTables(flowCapableNodeOperational);
         final Map<Uint8, Table> tableOperationalMap = FlowCapableNodeLookups.wrapTablesToMap(tablesOperational);
 
         return ReconcileUtil.resolveFlowDiffsInAllTables(nodeId, tableOperationalMap, tablesConfigured, true);
@@ -155,12 +156,12 @@ public class SyncReactorImpl implements SyncReactor {
     @VisibleForTesting
     private static Map<TableKey, ItemSyncBox<Flow>> extractFlowsToRemove(final NodeId nodeId,
             final FlowCapableNode flowCapableNodeConfigured, final FlowCapableNode flowCapableNodeOperational) {
-        final List<Table> tablesOperational = ReconcileUtil.safeTables(flowCapableNodeOperational);
+        final Collection<Table> tablesOperational = ReconcileUtil.safeTables(flowCapableNodeOperational);
         if (tablesOperational.isEmpty()) {
             return Collections.emptyMap();
         }
 
-        final List<Table> tablesConfigured = ReconcileUtil.safeTables(flowCapableNodeConfigured);
+        final Collection<Table> tablesConfigured = ReconcileUtil.safeTables(flowCapableNodeConfigured);
         final Map<Uint8, Table> tableConfiguredMap = FlowCapableNodeLookups.wrapTablesToMap(tablesConfigured);
 
         return ReconcileUtil.resolveFlowDiffsInAllTables(nodeId, tableConfiguredMap, tablesOperational, false);
@@ -170,8 +171,8 @@ public class SyncReactorImpl implements SyncReactor {
     private static ItemSyncBox<Meter> extractMetersToRemove(final NodeId nodeId,
                                                             final FlowCapableNode flowCapableNodeConfigured,
                                                             final FlowCapableNode flowCapableNodeOperational) {
-        final List<Meter> metersConfigured = ReconcileUtil.safeMeters(flowCapableNodeConfigured);
-        final List<Meter> metersOperational = ReconcileUtil.safeMeters(flowCapableNodeOperational);
+        final Collection<Meter> metersConfigured = ReconcileUtil.safeMeters(flowCapableNodeConfigured);
+        final Collection<Meter> metersOperational = ReconcileUtil.safeMeters(flowCapableNodeOperational);
         final Map<MeterId, Meter> meterConfiguredMap = FlowCapableNodeLookups.wrapMetersToMap(metersConfigured);
 
         return ReconcileUtil.resolveMeterDiffs(nodeId, meterConfiguredMap, metersOperational, false);
@@ -181,8 +182,8 @@ public class SyncReactorImpl implements SyncReactor {
     private static List<ItemSyncBox<Group>> extractGroupsToRemove(final NodeId nodeId,
                                                                   final FlowCapableNode flowCapableNodeConfigured,
                                                                   final FlowCapableNode flowCapableNodeOperational) {
-        final List<Group> groupsConfigured = ReconcileUtil.safeGroups(flowCapableNodeConfigured);
-        final List<Group> groupsOperational = ReconcileUtil.safeGroups(flowCapableNodeOperational);
+        final Collection<Group> groupsConfigured = ReconcileUtil.safeGroups(flowCapableNodeConfigured);
+        final Collection<Group> groupsOperational = ReconcileUtil.safeGroups(flowCapableNodeOperational);
         final Map<Uint32, Group> groupConfiguredMap = FlowCapableNodeLookups.wrapGroupsToMap(groupsConfigured);
 
         final List<Group> pendingGroups = new ArrayList<>();
index 3c85a7d7ed36fbb1719e2dbbf7b54328654eaf97..ff8fa87a9b7088b57b45467d086bd88c2f86c71a 100644 (file)
@@ -17,6 +17,7 @@ import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -163,7 +164,8 @@ public class SyncPlanPushStrategyFlatBatchImpl implements SyncPlanPushStrategy {
                 if (!result.isSuccessful() && result.getResult() != null
                         && !result.getResult().getBatchFailure().isEmpty()) {
                     Map<Range<Uint16>, Batch> batchMap = mapBatchesToRanges(inputBatchBag, failureIndexLimit);
-                    decrementBatchFailuresCounters(result.getResult().getBatchFailure(), batchMap, counters);
+                    decrementBatchFailuresCounters(result.getResult().nonnullBatchFailure().values(), batchMap,
+                            counters);
                 }
             }
 
@@ -176,7 +178,7 @@ public class SyncPlanPushStrategyFlatBatchImpl implements SyncPlanPushStrategy {
 
     @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
             justification = "https://github.com/spotbugs/spotbugs/issues/811")
-    private static void decrementBatchFailuresCounters(final List<BatchFailure> batchFailures,
+    private static void decrementBatchFailuresCounters(final Collection<BatchFailure> batchFailures,
                                                 final Map<Range<Uint16>, Batch> batchMap,
                                                 final SyncCrudCounters counters) {
         for (BatchFailure batchFailure : batchFailures) {
index 9fdb17d070eeadf4c803a9ab66480a70457ff910..cf85bc277a7f8f7850df95134c70124db47add3d 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.openflowplugin.applications.frsync.util;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
@@ -36,7 +36,7 @@ public final class FlowCapableNodeLookups {
     }
 
     @NonNull
-    public static Map<Uint8, Table> wrapTablesToMap(@Nullable final List<Table> tables) {
+    public static Map<Uint8, Table> wrapTablesToMap(@Nullable final Collection<Table> tables) {
         final Map<Uint8, Table> tableMap;
 
         if (tables == null) {
@@ -53,7 +53,7 @@ public final class FlowCapableNodeLookups {
     }
 
     @NonNull
-    public static Map<FlowDescriptor, Flow> wrapFlowsToMap(@Nullable final List<Flow> flows) {
+    public static Map<FlowDescriptor, Flow> wrapFlowsToMap(@Nullable final Collection<Flow> flows) {
         final Map<FlowDescriptor, Flow> flowMap;
 
         if (flows == null) {
@@ -74,7 +74,7 @@ public final class FlowCapableNodeLookups {
     }
 
     @NonNull
-    public static Map<MeterId, Meter> wrapMetersToMap(@Nullable final List<Meter> meters) {
+    public static Map<MeterId, Meter> wrapMetersToMap(@Nullable final Collection<Meter> meters) {
         final Map<MeterId, Meter> meterMap;
 
         if (meters == null) {
@@ -91,7 +91,7 @@ public final class FlowCapableNodeLookups {
     }
 
     @NonNull
-    public static Map<Uint32, Group> wrapGroupsToMap(@Nullable final List<Group> groups) {
+    public static Map<Uint32, Group> wrapGroupsToMap(@Nullable final Collection<Group> groups) {
         final Map<Uint32, Group> groupMap;
 
         if (groups == null) {
index cc5db45dd141e1636e60216ff7d6ee90beba765e..0d3799768da246b88e2144a9f1e6650ccc5fd97d 100644 (file)
@@ -224,8 +224,8 @@ public final class ReconcileUtil {
     public static boolean checkGroupPrecondition(final Set<Uint32> installedGroupIds, final Group pendingGroup) {
         boolean okToInstall = true;
         // check each bucket in the pending group
-        for (Bucket bucket : pendingGroup.getBuckets().getBucket()) {
-            for (Action action : bucket.getAction()) {
+        for (Bucket bucket : pendingGroup.getBuckets().nonnullBucket().values()) {
+            for (Action action : bucket.nonnullAction().values()) {
                 // if the output action is a group
                 if (GroupActionCase.class.equals(action.getAction().implementedInterface())) {
                     Uint32 groupId = ((GroupActionCase) action.getAction()).getGroupAction().getGroupId();
@@ -271,7 +271,7 @@ public final class ReconcileUtil {
      */
     public static ItemSyncBox<Meter> resolveMeterDiffs(final NodeId nodeId,
                                                        final Map<MeterId, Meter> meterOperationalMap,
-                                                       final List<Meter> metersConfigured,
+                                                       final Collection<Meter> metersConfigured,
                                                        final boolean gatherUpdates) {
         LOG.trace("resolving meters for {}", nodeId.getValue());
         final ItemSyncBox<Meter> syncBox = new ItemSyncBox<>();
@@ -297,7 +297,7 @@ public final class ReconcileUtil {
      * @param gatherUpdates      check content of pending item if present on device (and create update task eventually)
      * @return list of safe synchronization steps
      */
-    private static ItemSyncBox<Flow> resolveFlowDiffsInTable(final List<Flow> flowsConfigured,
+    private static ItemSyncBox<Flow> resolveFlowDiffsInTable(final Collection<Flow> flowsConfigured,
                                                             final Map<FlowDescriptor, Flow> flowOperationalMap,
                                                             final boolean gatherUpdates) {
         final ItemSyncBox<Flow> flowsSyncBox = new ItemSyncBox<>();
@@ -327,13 +327,13 @@ public final class ReconcileUtil {
      * @return map : key={@link TableKey}, value={@link ItemSyncBox} of safe synchronization steps
      */
     public static Map<TableKey, ItemSyncBox<Flow>> resolveFlowDiffsInAllTables(final NodeId nodeId,
-            final Map<Uint8, Table> tableOperationalMap, final List<Table> tablesConfigured,
+            final Map<Uint8, Table> tableOperationalMap, final Collection<Table> tablesConfigured,
             final boolean gatherUpdates) {
         LOG.trace("resolving flows in tables for {}", nodeId.getValue());
         final Map<TableKey, ItemSyncBox<Flow>> tableFlowSyncBoxes = new HashMap<>();
         for (final Table tableConfigured : tablesConfigured) {
-            final List<Flow> flowsConfigured = tableConfigured.getFlow();
-            if (flowsConfigured == null || flowsConfigured.isEmpty()) {
+            final Collection<Flow> flowsConfigured = tableConfigured.nonnullFlow().values();
+            if (flowsConfigured.isEmpty()) {
                 continue;
             }
 
@@ -342,7 +342,7 @@ public final class ReconcileUtil {
             // wrap existing (on device) flows in current table into map
             final Map<FlowDescriptor, Flow> flowOperationalMap = FlowCapableNodeLookups.wrapFlowsToMap(
                     tableOperational != null
-                            ? tableOperational.getFlow()
+                            ? tableOperational.nonnullFlow().values()
                             : null);
 
 
@@ -355,15 +355,15 @@ public final class ReconcileUtil {
         return tableFlowSyncBoxes;
     }
 
-    public static List<Group> safeGroups(FlowCapableNode node) {
-        return node == null ? Collections.emptyList() : node.nonnullGroup();
+    public static Collection<Group> safeGroups(FlowCapableNode node) {
+        return node == null ? Collections.emptyList() : node.nonnullGroup().values();
     }
 
-    public static List<Table> safeTables(FlowCapableNode node) {
-        return node == null ? Collections.emptyList() : node.nonnullTable();
+    public static Collection<Table> safeTables(FlowCapableNode node) {
+        return node == null ? Collections.emptyList() : node.nonnullTable().values();
     }
 
-    public static List<Meter> safeMeters(FlowCapableNode node) {
-        return node == null ? Collections.emptyList() : node.nonnullMeter();
+    public static Collection<Meter> safeMeters(FlowCapableNode node) {
+        return node == null ? Collections.emptyList() : node.nonnullMeter().values();
     }
 }
index 97068a9ac201ba7301c4adbad16112d84a74eded..2fdf40625904b8bf797cb7a3bfd40b1e6501a7d7 100644 (file)
@@ -19,6 +19,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder;
@@ -133,6 +134,7 @@ public final class DSInputFactory {
 
     public static Group createGroupWithPreconditions(final long groupIdValue, final long... requiredId) {
         final List<Action> actionBag = new ArrayList<>();
+        int key = 0;
         for (long groupIdPrecondition : requiredId) {
             final GroupAction groupAction = new GroupActionBuilder()
                     .setGroupId(groupIdPrecondition)
@@ -142,6 +144,7 @@ public final class DSInputFactory {
                     .build();
             final Action action = new ActionBuilder()
                     .setAction(groupActionCase)
+                    .withKey(new ActionKey(key++))
                     .build();
             actionBag.add(action);
         }
index dab4687d7ae506f0b8ad6ca1f9e00cefaefdde2c..0a4d143af541aadcd3cd36d2f09758a31d4928cb 100644 (file)
@@ -11,7 +11,7 @@ import com.google.common.util.concurrent.Futures;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Collections;
-import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import org.junit.Assert;
 import org.junit.Before;
@@ -41,6 +41,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.Fl
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.snapshot.gathering.status.grouping.SnapshotGatheringStatusEnd;
 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.node.NodeConnector;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yangtools.util.concurrent.FluentFutures;
@@ -83,7 +85,7 @@ public class SimplifiedOperationalListenerTest {
     @Mock
     private DeviceMastershipManager deviceMastershipManager;
     @Mock
-    private List nodeConnector;
+    private Map<NodeConnectorKey, NodeConnector> nodeConnector;
     @Mock
     private Node operationalNodeEmpty;
 
index b99cdaabf2095e0e3a7efc1cbc257ec6258c8900..c8c85bf7420096ef19c42c67bece8de42dfc8424 100644 (file)
@@ -110,8 +110,10 @@ public class TableForwarderTest {
         Assert.assertEquals(nodePath, updateTableInput.getNode().getValue());
 
         Assert.assertEquals(1, updateTableInput.getOriginalTable().getTableFeatures().size());
-        Assert.assertEquals("test-table", updateTableInput.getOriginalTable().getTableFeatures().get(0).getName());
+        Assert.assertEquals("test-table", updateTableInput.getOriginalTable().nonnullTableFeatures().values()
+                .iterator().next().getName());
         Assert.assertEquals(1, updateTableInput.getUpdatedTable().getTableFeatures().size());
-        Assert.assertEquals("another-table", updateTableInput.getUpdatedTable().getTableFeatures().get(0).getName());
+        Assert.assertEquals("another-table", updateTableInput.getUpdatedTable().nonnullTableFeatures().values()
+                .iterator().next().getName());
     }
 }
\ No newline at end of file
index 9d1deecbc608c2d3677fdd681a45b6b235072ab7..a4cd934b7439e7e5693957640b37b5ecb220a96b 100644 (file)
@@ -38,6 +38,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.FlowCapableTransactionService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
@@ -254,6 +255,7 @@ public class ReconcileUtilTest {
 
     private static Group createGroupWithPreconditions(final long groupIdValue, final long... requiredId) {
         final List<Action> actionBag = new ArrayList<>();
+        int key = 0;
         for (long groupIdPrecondition : requiredId) {
             final GroupAction groupAction = new GroupActionBuilder()
                     .setGroupId(groupIdPrecondition)
@@ -263,6 +265,7 @@ public class ReconcileUtilTest {
                     .build();
             final Action action = new ActionBuilder()
                     .setAction(groupActionCase)
+                    .withKey(new ActionKey(key++))
                     .build();
             actionBag.add(action);
         }
index 12ac9bf778613583888570022a061fe65ebdad88..95de7e23d124cef0ba461f023b55634ade07bc5f 100644 (file)
@@ -76,7 +76,8 @@ public class NodeConnectorStatNotificationSupplierImplTest {
                 .createNotification(createTestConnectorStat(), createTestConnectorStatPath());
         assertNotNull(notification);
         assertEquals(FLOW_NODE_ID, notification.getId().getValue());
-        assertEquals(FLOW_CODE_CONNECTOR_ID, notification.getNodeConnector().get(0).getId().getValue());
+        assertEquals(FLOW_CODE_CONNECTOR_ID, notification.nonnullNodeConnector().values().iterator().next().getId()
+                .getValue());
     }
 
     @Test
index a13987a58b6a2bdc561ec88c032fcdf4cef591a5..0337834e90ad3c01ea84f22aec79050932397f00 100644 (file)
@@ -78,7 +78,8 @@ public class QueueStatNotificationSupplierImplTest {
                 .createNotification(createTestQueueStat(), createTestQueueStatPath());
         assertNotNull(notification);
         assertEquals(FLOW_NODE_ID, notification.getId().getValue());
-        assertEquals(FLOW_CODE_CONNECTOR_ID, notification.getNodeConnector().get(0).getId().getValue());
+        assertEquals(FLOW_CODE_CONNECTOR_ID, notification.nonnullNodeConnector().values().iterator().next().getId()
+                .getValue());
     }
 
     @Test
index bf99da451cbbd36321db58e972bbc6cbe403f62c..e2f1d4887f82c4308ed44f2cce3a2dcef566b887 100644 (file)
@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 30bfd73598343c3b66c6baad480709bc338ec7ba..6680c58c11e75d0ccdf4411de92641994aa6ba3f 100644 (file)
@@ -228,7 +228,8 @@ public class ReconciliationServiceImpl implements ReconciliationService, AutoClo
                 }
             }
             try {
-                tx.merge(LogicalDatastoreType.OPERATIONAL, instanceIdentifier, counterBuilder.build(), true);
+                tx.mergeParentStructureMerge(LogicalDatastoreType.OPERATIONAL, instanceIdentifier,
+                        counterBuilder.build());
                 tx.commit().get();
             } catch (InterruptedException | ExecutionException e) {
                 LOG.error("Exception while submitting counter for {}", nodeId, e);
index d2b783d8aa85de134e4516450374d0a752d1fd66..8290d799699d308a744948c41910686e34f0b3cd 100644 (file)
@@ -8,8 +8,8 @@
 
 package org.opendaylight.openflowplugin.applications.southboundcli.cli;
 
+import java.util.Collection;
 import java.util.Formatter;
-import java.util.List;
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
 import org.opendaylight.mdsal.binding.api.DataBroker;
@@ -29,7 +29,7 @@ public class ReconciliationCount extends OsgiCommandSupport {
     @SuppressWarnings("checkstyle:RegexpSinglelineJava")
     @Override
     protected Object doExecute() {
-        List<ReconcileCounter> result = ShellUtil.getReconcileCount(dataBroker);
+        Collection<ReconcileCounter> result = ShellUtil.getReconcileCount(dataBroker);
         if (result.isEmpty()) {
             System.out.println("Reconciliation count not yet available for openflow nodes.");
         } else {
index 4eb6735ec9cefda426016097e859210820857bb9..d72029bf366bc574b8bb28a389d3617c10c6519b 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.openflowplugin.applications.southboundcli.util;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -79,8 +80,8 @@ public final class ShellUtil {
             Optional<Node> result = tx.read(LogicalDatastoreType.OPERATIONAL, path).get();
             if (result.isPresent()) {
                 Node node = result.get();
-                String name = null;
-                List<NodeConnector> nodeConnectors = null;
+                String name;
+                Collection<NodeConnector> nodeConnectors = node.nonnullNodeConnector().values();
                 List<String> portList = new ArrayList<>();
                 FlowCapableNode flowCapableNode = node.<FlowCapableNode>augmentation(FlowCapableNode.class);
                 if (flowCapableNode != null) {
@@ -89,7 +90,6 @@ public final class ShellUtil {
                     LOG.error("Error while converting OFNode:{} to FlowCapableNode", node.getId());
                     return null;
                 }
-                nodeConnectors = node.getNodeConnector();
                 for (NodeConnector nodeConnector : nodeConnectors) {
                     FlowCapableNodeConnector flowCapableNodeConnector =
                             nodeConnector.augmentation(FlowCapableNodeConnector.class);
@@ -112,15 +112,15 @@ public final class ShellUtil {
         return ofNode;
     }
 
-    public static List<ReconcileCounter> getReconcileCount(final DataBroker dataBroker) {
+    public static Collection<ReconcileCounter> getReconcileCount(final DataBroker dataBroker) {
         InstanceIdentifier<ReconciliationCounter> instanceIdentifier = InstanceIdentifier
                 .builder(ReconciliationCounter.class).build();
-        List<ReconcileCounter> output = Collections.emptyList();
+        Collection<ReconcileCounter> output = Collections.emptyList();
         try (ReadTransaction tx = dataBroker.newReadOnlyTransaction()) {
             Optional<ReconciliationCounter> result =
                     tx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier).get();
             if (result.isPresent()) {
-                output = result.get().getReconcileCounter();
+                output = result.get().nonnullReconcileCounter().values();
             }
         } catch (ExecutionException | InterruptedException | NullPointerException e) {
             LOG.error("Error reading reconciliation counter from datastore", e);
index 26d9ba95587c0ef85d2ccd2f46859d0e5c162775..42a67955f348c2179072bb8fea5f029d6d8dd201 100644 (file)
@@ -105,7 +105,7 @@ public class LLDPDataTreeChangeListenerTest {
     }
 
     private static void evaluateInstruction(final Instruction instruction) {
-        if (instruction.getInstruction() instanceof ApplyActionsCase) {
+        if (instruction != null && instruction.getInstruction() instanceof ApplyActionsCase) {
             ApplyActionsCase applyActionsCase = (ApplyActionsCase) instruction.getInstruction();
             assertNotNull(applyActionsCase.getApplyActions().getAction());
             assertEquals(1, applyActionsCase.getApplyActions().getAction().size());
index 817499eb5f8d25ff30388816cd4ee10026ea3154..8f5e8eac23a5137cb2932e424c826116b90be86e 100644 (file)
@@ -18,7 +18,6 @@ import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Optional;
-import org.apache.commons.lang3.ArrayUtils;
 import org.opendaylight.mdsal.eos.binding.api.Entity;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService;
 import org.opendaylight.mdsal.eos.common.api.EntityOwnershipState;
@@ -205,7 +204,7 @@ public final class LLDPDiscoveryUtils {
         boolean secAuthenticatorOk = false;
         if (hashLldptlv != null) {
             byte[] rawTlvValue = hashLldptlv.getValue();
-            byte[] lldpCustomSecurityHash = ArrayUtils.subarray(rawTlvValue, 4, rawTlvValue.length);
+            byte[] lldpCustomSecurityHash = Arrays.copyOfRange(rawTlvValue, 4, rawTlvValue.length);
             byte[] calculatedHash = getValueForLLDPPacketIntegrityEnsuring(srcNodeConnectorId);
             secAuthenticatorOk = Arrays.equals(calculatedHash, lldpCustomSecurityHash);
         } else {
index 2193a13576b0d9958dd98bbca8939b533ac94f5e..c2605a334e81ad36c32bc37498cdc21ba56f6cea 100644 (file)
@@ -47,7 +47,7 @@ final class TopologyManagerUtil {
             return;
         }
 
-        for (Link link : topologyOptional.get().nonnullLink()) {
+        for (Link link : topologyOptional.get().nonnullLink().values()) {
             if (id.equals(link.getSource().getSourceNode()) || id.equals(link.getDestination().getDestNode())) {
                 manager.addDeleteOperationToTxChain(LogicalDatastoreType.OPERATIONAL, linkPath(link, topology));
             }
@@ -75,7 +75,7 @@ final class TopologyManagerUtil {
             return;
         }
 
-        for (Link link : topologyOptional.get().nonnullLink()) {
+        for (Link link : topologyOptional.get().nonnullLink().values()) {
             if (id.equals(link.getSource().getSourceTp()) || id.equals(link.getDestination().getDestTp())) {
                 manager.addDeleteOperationToTxChain(LogicalDatastoreType.OPERATIONAL, linkPath(link, topology));
             }
index 7ca06ca0c33ebc3c954ac1d6f66bb4cd8975d996..34ac9ae80678ae7c040968e8be0e1127adccf569 100644 (file)
@@ -109,9 +109,9 @@ public class FlowCapableTopologyExporterTest {
         waitForSubmit(submitLatch);
 
         ArgumentCaptor<Link> mergedNode = ArgumentCaptor.forClass(Link.class);
-        verify(mockTx).merge(eq(LogicalDatastoreType.OPERATIONAL), eq(topologyIID.child(
+        verify(mockTx).mergeParentStructureMerge(eq(LogicalDatastoreType.OPERATIONAL), eq(topologyIID.child(
                         Link.class, new LinkKey(new LinkId(sourceNodeConnKey.getId())))),
-                mergedNode.capture(), eq(true));
+                mergedNode.capture());
         assertEquals("Source node ID", "sourceNode",
                 mergedNode.getValue().getSource().getSourceNode().getValue());
         assertEquals("Dest TP ID", "sourceTP",
index 162a4c74de3ec5379422f23236f3d4045bb1fffe..bc7f67b8a0952f2e7c48a8ce6f7514f345d83440 100644 (file)
@@ -69,7 +69,7 @@ public class NodeChangeListenerImplTest extends DataTreeChangeListenerBase {
         List<Link> linkList = Arrays.asList(
                 newLink("link1", newSourceNode("node1"), newDestNode("dest")),
                 newLink("link2", newSourceNode("source"), newDestNode("node1")),
-                newLink("link2", newSourceNode("source2"), newDestNode("dest2")));
+                newLink("link3", newSourceNode("source2"), newDestNode("dest2")));
         final Topology topology = new TopologyBuilder().setLink(linkList).build();
 
         final InstanceIdentifier[] expDeletedIIDs = {
@@ -174,8 +174,8 @@ public class NodeChangeListenerImplTest extends DataTreeChangeListenerBase {
 
         ArgumentCaptor<Node> mergedNode = ArgumentCaptor.forClass(Node.class);
         NodeId expNodeId = new NodeId("node1");
-        verify(mockTx).merge(eq(LogicalDatastoreType.OPERATIONAL), eq(topologyIID.child(Node.class,
-                new NodeKey(expNodeId))), mergedNode.capture(), eq(true));
+        verify(mockTx).mergeParentStructureMerge(eq(LogicalDatastoreType.OPERATIONAL), eq(topologyIID.child(Node.class,
+                new NodeKey(expNodeId))), mergedNode.capture());
         assertEquals("getNodeId", expNodeId, mergedNode.getValue().getNodeId());
         InventoryNode augmentation = mergedNode.getValue().augmentation(InventoryNode.class);
         assertNotNull("Missing augmentation", augmentation);
index c4bc396e006caff69708f4004f2fcce090017a46..92ab192d3b28864492fb5b40935fe6430b087c24 100644 (file)
@@ -197,8 +197,8 @@ public class TerminationPointChangeListenerImplTest extends DataTreeChangeListen
         InstanceIdentifier<TerminationPoint> expTpPath = topologyIID.child(
                 Node.class, new NodeKey(expNodeId)).child(TerminationPoint.class,
                         new TerminationPointKey(expTpId));
-        verify(mockTx).merge(eq(LogicalDatastoreType.OPERATIONAL), eq(expTpPath),
-                mergedNode.capture(), eq(true));
+        verify(mockTx).mergeParentStructureMerge(eq(LogicalDatastoreType.OPERATIONAL), eq(expTpPath),
+                mergedNode.capture());
         assertEquals("getTpId", expTpId, mergedNode.getValue().getTpId());
         InventoryNodeConnector augmentation = mergedNode.getValue().augmentation(
                 InventoryNodeConnector.class);
@@ -245,8 +245,8 @@ public class TerminationPointChangeListenerImplTest extends DataTreeChangeListen
                 Node.class, new NodeKey(new NodeId("node1"))).child(TerminationPoint.class,
                         new TerminationPointKey(new TpId("tp1")));
 
-        verify(mockTx).merge(eq(LogicalDatastoreType.OPERATIONAL), eq(expTpPath),
-                any(TerminationPoint.class), eq(true));
+        verify(mockTx).mergeParentStructureMerge(eq(LogicalDatastoreType.OPERATIONAL), eq(expTpPath),
+                any(TerminationPoint.class));
 
         assertDeletedIDs(new InstanceIdentifier[]{topologyIID.child(Link.class,
                 linkList.get(0).key())}, deletedLinkIDs);
@@ -290,8 +290,8 @@ public class TerminationPointChangeListenerImplTest extends DataTreeChangeListen
                 Node.class, new NodeKey(new NodeId("node1"))).child(TerminationPoint.class,
                         new TerminationPointKey(new TpId("tp1")));
 
-        verify(mockTx).merge(eq(LogicalDatastoreType.OPERATIONAL), eq(expTpPath),
-                any(TerminationPoint.class), eq(true));
+        verify(mockTx).mergeParentStructureMerge(eq(LogicalDatastoreType.OPERATIONAL), eq(expTpPath),
+                any(TerminationPoint.class));
 
         assertDeletedIDs(new InstanceIdentifier[]{topologyIID.child(Link.class,
                 linkList.get(0).key())}, deletedLinkIDs);
index 33cb82e5df48953064f3ba9644c76cce46f3038c..f7569d28c1c7359bb2b5032c4b6638e0e66c2479 100644 (file)
@@ -42,6 +42,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.LinkKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 
@@ -123,7 +124,8 @@ public final class TestUtils {
     }
 
     static Link newLink(String id, Source source, Destination dest) {
-        return new LinkBuilder().setLinkId(new LinkId(id)).setSource(source).setDestination(dest).build();
+        return new LinkBuilder().setLinkId(new LinkId(id)).setSource(source).setDestination(dest)
+                .withKey(new LinkKey(new LinkId(id))).build();
     }
 
     static Destination newDestTp(String id) {
index 182763bb522328536178453e14117040aea1eab6..9d217c19174941c9463ffeb6aea4a45d9b0289f7 100644 (file)
@@ -13,7 +13,7 @@
   <parent>
     <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>odlparent-lite</artifactId>
-    <version>6.0.4</version>
+    <version>7.0.1</version>
     <relativePath/>
   </parent>
 
index ee94fdd9fef99ab6e895e221aee8dd28eddb67b1..f649f64f001c16253502fcb2df498499ed1b4992 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>karaf4-parent</artifactId>
-    <version>6.0.4</version>
+    <version>7.0.1</version>
   </parent>
   <groupId>org.opendaylight.openflowplugin</groupId>
   <artifactId>openflowplugin-karaf</artifactId>
index 7303d732388a339c6c0935ba4515513dbc494db2..c9d1e519e79f00efe18a6b6362510c0c9e3bdee1 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>feature-repo-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 2090d0477ca2da813a13e516d5257b20ed6feacd..f4b211cd7fa98da3ffc8a0b275570227d7452138 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 52e8d9c4434b0e190f0852654099ee4a5ae05732..a210ae9902a075453e08550049687272888a6692 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 9ce686b8e3886d443ec39fa956d7f9a42fea5398..124ed3e6f2ef0388574f0e2aa5121b8551d0c936 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index dcab50ae121afc08ee5a1fe8f823c0510d6c4c5e..be0ab2c7a0a9a9f0d0c33fc705133dc0773bf5ba 100644 (file)
@@ -3,7 +3,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
     <modelVersion>4.0.0</modelVersion>
index 6c3a6819fa05a28a7088dbe0e43557adb6e5b7d8..d0dd60f4e832e8e9ca01c5b8e014e33215cc1be7 100644 (file)
@@ -49,9 +49,9 @@ public class GroupingLooseResolverTest {
                 mb2.addAugmentation(GeneralAugMatchNotifPacketIn.class, odlxxx2).build();
 
         Assert.assertEquals(JoachimTheBig.class,
-                eqGroup.getExtension(match1).get().getExtensionList().get(0).getExtensionKey());
+                eqGroup.getExtension(match1).get().nonnullExtensionList().values().iterator().next().getExtensionKey());
         Assert.assertEquals(JoachimTheTiny.class,
-                eqGroup.getExtension(match2).get().getExtensionList().get(0).getExtensionKey());
+                eqGroup.getExtension(match2).get().nonnullExtensionList().values().iterator().next().getExtensionKey());
     }
 
     private interface JoachimTheBig extends ExtensionKey {
index 4ddc9157807baf2c31ff3267600eb41ef43afbae..43c1e2998f74726996cf3eabf95db6de1e9f5322 100644 (file)
@@ -49,9 +49,9 @@ public class GroupingResolverTest {
         Match match2 = mb2.addAugmentation(GeneralAugMatchNodesNodeTableFlow.class, odlxxx2).build();
 
         Assert.assertEquals(JoachimTheBig.class,
-                eqGroup.getExtension(match1).get().getExtensionList().get(0).getExtensionKey());
+                eqGroup.getExtension(match1).get().nonnullExtensionList().values().iterator().next().getExtensionKey());
         Assert.assertEquals(JoachimTheTiny.class,
-                eqGroup.getExtension(match2).get().getExtensionList().get(0).getExtensionKey());
+                eqGroup.getExtension(match2).get().nonnullExtensionList().values().iterator().next().getExtensionKey());
     }
 
     private interface JoachimTheBig extends ExtensionKey {
index f47fd103e0363bddf1e5d36b17a484635fcad10b..4e49367b4358b86aa149a3f7ca235397f77a9e47 100755 (executable)
@@ -45,9 +45,11 @@ public class SetFieldExtensionTest {
                 odlxxx2).build();
 
         Assert.assertEquals(ZVendorExt1.class,
-                eqGroup.getExtension(setField1).get().getExtensionList().get(0).getExtensionKey());
+                eqGroup.getExtension(setField1).get().nonnullExtensionList().values().iterator().next()
+                        .getExtensionKey());
         Assert.assertEquals(ZVendorExt2.class,
-                eqGroup.getExtension(setField2).get().getExtensionList().get(0).getExtensionKey());
+                eqGroup.getExtension(setField2).get().nonnullExtensionList().values().iterator().next()
+                        .getExtensionKey());
     }
 
     private interface ZVendorExt1 extends ExtensionKey {
index 7d96d23778a919eada5ac644809fb7088ca3b713..2e7328352c3e480c919d6a69d2782a6dd61aeca4 100644 (file)
@@ -142,8 +142,8 @@ public class Icmpv6NDOptionsTypeConvertorTest {
         SetField setField = sb.addAugmentation(GeneralAugMatchNodesNodeTableFlowWriteActionsSetField.class,
                  ndOptionsTypeSetField).build();
 
-        Assert.assertEquals(Icmpv6NdOptionsTypeKey.class, eqGroup.getExtension(setField).get().getExtensionList().get(0)
-                 .getExtensionKey());
+        Assert.assertEquals(Icmpv6NdOptionsTypeKey.class, eqGroup.getExtension(setField).get().nonnullExtensionList()
+                 .values().iterator().next().getExtensionKey());
     }
 
 }
\ No newline at end of file
index a6d4c26b7f205fd24cacc29776ea93cc009376df..38b757bd1cc393f6e3ed0468799f1d726fcc02c4 100644 (file)
@@ -142,8 +142,8 @@ public class Icmpv6NDReservedConvertorTest {
         SetField setField = sb.addAugmentation(GeneralAugMatchNodesNodeTableFlowWriteActionsSetField.class,
                 ndReservedSetField).build();
 
-        Assert.assertEquals(Icmpv6NdReservedKey.class, eqGroup.getExtension(setField).get().getExtensionList().get(0)
-                .getExtensionKey());
+        Assert.assertEquals(Icmpv6NdReservedKey.class, eqGroup.getExtension(setField).get().nonnullExtensionList()
+                .values().iterator().next().getExtensionKey());
     }
 
 }
\ No newline at end of file
index 5fef298dce001aa5c8ee2cdac1216fdd8090cd0a..c90e21d50ca319736f5b31bf8a7e36ce77816b36 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.openflowplugin.extension.onf.converter;
 
+import java.util.Collection;
 import java.util.List;
 import java.util.Optional;
 import org.opendaylight.openflowplugin.extension.api.ConverterMessageToOFJava;
@@ -22,7 +23,7 @@ import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.XidCo
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.UpdatedFlowBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.UpdatedGroupBuilder;
@@ -178,9 +179,10 @@ public class BundleAddMessageConverter implements
         Optional<PortModInput> portModInput = Optional.empty();
         final Class<?> clazz = messageCase.implementedInterface();
         if (clazz.equals(BundleUpdatePortCase.class)) {
-            portModInput = CONVERTER_EXECUTOR.convert(new PortBuilder(
-                    ((BundleUpdatePortCase) messageCase).getUpdatePortCaseData().getPort().getPort().get(0)).build(),
-                    data);
+            Collection<Port> ports
+                    = ((BundleUpdatePortCase) messageCase).getUpdatePortCaseData().getPort().nonnullPort().values();
+            Port port = ports.iterator().next();
+            portModInput = CONVERTER_EXECUTOR.convert(port, data);
         }
 
         if (portModInput.isPresent()) {
index 1ee9b7f6e74897c3625b36dc78c28eb6e093ba84..220fe7b00daf309fbf808d243c100cf06b2c8924 100644 (file)
@@ -26,6 +26,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.P
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.PortBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
@@ -151,6 +152,7 @@ public class BundleAddMessageConverterTest {
                                     .setAdvertisedFeatures(Mockito.mock(PortFeatures.class))
                                     .setPortNumber(new PortNumberUni(Uint32.ZERO))
                                     .setHardwareAddress(Mockito.mock(MacAddress.class))
+                                    .withKey(new PortKey(Uint32.ZERO))
                                     .build()))
                             .build()).build())
                 .build(), BundlePortModCase.class);
@@ -194,7 +196,7 @@ public class BundleAddMessageConverterTest {
                     convertedProperty.getBundlePropertyExperimenterData());
         } else {
             Assert.assertTrue("Properties not empty",
-                    converted.getOnfAddMessageGroupingData().getBundleProperty().isEmpty());
+                    converted.getOnfAddMessageGroupingData().nonnullBundleProperty().isEmpty());
         }
     }
 
index 2afe830f482e1ede4f5423a9b1091d4f52f3f693..a659a9e2ced851b2a1b164d2813ba90a84249aab 100644 (file)
@@ -118,7 +118,7 @@ public class BundleControlConverterTest {
             Assert.assertTrue("Properties not empty",
                     ofjMessage
                             .getOnfControlGroupingData()
-                            .getBundleProperty()
+                            .nonnullBundleProperty()
                             .isEmpty());
         }
     }
index 1b20384eec7d941d9a6b65fc2e3e28afa8d3f2dd..4b83b238e7c115f4d37f4a36e47f4eeee8e843de 100644 (file)
@@ -57,7 +57,7 @@ public class BundleControlFactoryTest {
         Assert.assertEquals("Wrong type",
                 BundleControlType.ONFBCTOPENREPLY, builtByFactory.getOnfControlGroupingData().getType());
         Assert.assertTrue("Properties not empty",
-                builtByFactory.getOnfControlGroupingData().getBundleProperty().isEmpty());
+                builtByFactory.getOnfControlGroupingData().nonnullBundleProperty().isEmpty());
     }
 
     @Test
index 403cb8d3f141de1aff68f5dad1044f29185ebfe5..e17e1221b06f2d51c2f4226bcac0dfe08f066d9c 100644 (file)
@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index d7412d3dc300463a511eafd508476163804fdb3b..fb58022b3e87f3de14cfd20673230bf3588caa44 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>feature-repo-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index deab0e6239f0a8f0088541ed84cc14ab9b7d5c99..6e46eaad2b4e2bd4130c58e379109531f9fc732b 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 332294dd146073b924546a40cba6869766e07149..73e686b3294ca4995db19a5c9545b8e19c6092fd 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index a2aeaf8db834bd1c27365a836fe640a427f6b224..b71fb3ebc7e7b420279c8b44cdde426993f8613c 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index abf34f6808da9d6b3214e4694e7650006815cf72..ccdfe259e69285c92cf10423adf9ec16c86da596 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index e009af619ccd9017c8081da2d96f39408caf9f13..57ea296603fd850ec475f384946f4629b35115ed 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 2da600b4c0f066bc31e75be646594a42007acba8..bc1d89d64ab7ac1915a4f1bc7010bf5560989f58 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 6a6b3aafba9e655e7160862e9dbc94b5ed719d68..acbddad438efedbd0df9c9c336fb259adf38e6ee 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index ddae6474af127955cddfe603b6710fa266faf5b3..0d48560611a70c02f933e25261beaadbc4b7cbc4 100644 (file)
@@ -4,7 +4,7 @@
 <parent>
     <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>single-feature-parent</artifactId>
-    <version>6.0.4</version>
+    <version>7.0.1</version>
     <relativePath/>
 </parent>
 
index 34b6cf11fe3d010438c627ad4a3a8391127791bf..92dac0d1e98cc6a35afdf0c95beac74910c846db 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 46d63bceddb59bcf01873e65aea66f2df8be420a..49753b47e902079e62020bb6d3e446c358664005 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 039eef3a77c6f53f18e4b18e46894da3e669a52d..3cb4dfcc9aad4b4201c204679fcde0891e90f95c 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 334f544a2ca0c9b35d05e3b94f4deac3daabdd72..a50badf4959a02663857516795488fc18dbd4122 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 9d9f0f323db36e3f666f262f7973630c7775fdc6..8e597103c615dbe102d68ea568e8b7e312b6f45c 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 6bd0482fad1cc1c1733f2519b1d0578a6f679670..224aeee3d04a60cce873830e1819a5d2d82bfb85 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index ddd7d57aa6b86066e58e955df28034939fc08230..381645206d89deed53526477a12003a90e33b535 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index dd74cc0733b9fe8a25884717ace68d46f19016ab..1c201554f85157c21f02a3d9682131c5841dc2e1 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 66a193cef26f70052eb646a4074e629aa1261a21..43f86e33e82ad57a6b2ae8d91db47f12b14bcb58 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index be208d6d9094e5d6db2584910aaaa403e44ecf32..912b3205d61818449b21942046145497d39b8e47 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="odl-openflowplugin-libraries">
     <feature name="odl-openflowplugin-libraries">
-        <feature version="[6,7)">odl-guava</feature>
+        <feature version="[7,8)">odl-guava</feature>
     </feature>
 </features>
index 5981c39bb9a28a7debd4daa97e19a4bdcbe54df6..c005a082947a995bfab4470fc6a7e19c32e7bb0e 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
@@ -21,7 +21,7 @@
             <dependency>
                 <groupId>org.opendaylight.mdsal</groupId>
                 <artifactId>mdsal-artifacts</artifactId>
-                <version>5.0.9</version>
+                <version>6.0.0</version>
                 <scope>import</scope>
                 <type>pom</type>
             </dependency>
@@ -29,8 +29,8 @@
             <!-- Controller infrastructure -->
             <dependency>
                 <groupId>org.opendaylight.controller</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>1.11.0</version>
+                <artifactId>controller-artifacts</artifactId>
+                <version>2.0.0</version>
                 <scope>import</scope>
                 <type>pom</type>
             </dependency>
index f609b37c2c007f076566d127ce515211a1cda7bd..4af51145b4351dba6b3ff72f3c1ba60c65045c6b 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
@@ -28,8 +28,8 @@
             <!-- Controller infrastructure -->
             <dependency>
                 <groupId>org.opendaylight.controller</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>1.11.0</version>
+                <artifactId>controller-artifacts</artifactId>
+                <version>2.0.0</version>
                 <scope>import</scope>
                 <type>pom</type>
             </dependency>
index 956f688478bf659218152e7b95136e18c139ace2..21c9d3d8812e78474c264bfaeb6c22c16ae78415 100644 (file)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 3b034d95f19a17335e58572c0f6c6549d03b273f..e9768e91a1934ba6c23a477676c937f0aa587cd7 100644 (file)
@@ -37,8 +37,8 @@
       <artifactId>guava</artifactId>
     </dependency>
     <dependency>
-      <groupId>javax.xml.bind</groupId>
-      <artifactId>jaxb-api</artifactId>
+      <groupId>jakarta.xml.bind</groupId>
+      <artifactId>jakarta.xml.bind-api</artifactId>
     </dependency>
   </dependencies>
 
index 2d2471929b8a0dc2681c088eb0d8b6562d6e27c2..4eca7fa923603ce508eb85cd661889cbce1994c9 100644 (file)
@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 92661c1898d74e5dec3d6b88550f719788de9f30..be13979fef4aaf01d92f26bd688848a33a0a33c9 100644 (file)
@@ -6,7 +6,7 @@
   <parent>
     <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>odlparent-lite</artifactId>
-    <version>6.0.4</version>
+    <version>7.0.1</version>
     <relativePath/>
   </parent>
 
index 812fc4916d93940feb8eff0fa3a70ee3dc5bc9ce..bd2e1c0314c62ae8cfdda4551adf5f2fdeda9662 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>feature-repo-parent</artifactId>
-    <version>6.0.4</version>
+    <version>7.0.1</version>
     <relativePath/>
   </parent>
 
index 3dd50ff4f72fff51391fa16c0a4ae61e2816651b..e9fd5b6a0415223344e3b66e7c9ccd213f2e2483 100644 (file)
@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
@@ -33,7 +33,7 @@
             <dependency>
                 <groupId>org.opendaylight.mdsal</groupId>
                 <artifactId>mdsal-artifacts</artifactId>
-                <version>5.0.9</version>
+                <version>6.0.0</version>
                 <scope>import</scope>
                 <type>pom</type>
             </dependency>
index 0fb9e991ebe888b0abf2ce9735ea2d30bcfc2b75..29d13878641272a3aa974fd422a9d00d70149dd0 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>odlparent-lite</artifactId>
-    <version>6.0.4</version>
+    <version>7.0.1</version>
     <relativePath/>
   </parent>
 
index afa06e501a8aaa0c97567bcd262c987a37f1f752..bca6e3611a4c9f4235d7a713c1c6272eb70fe84d 100644 (file)
@@ -24,7 +24,7 @@
     grouping instructions-grouping {
         list instruction {
             config false;
-            key "experimenter-id";
+            ordered-by user;
             uses instruction-grouping;
             leaf experimenter-id {
                 type oft:experimenter-id;
index a5034cef1ea57cc8c1b984c9d67a832a7480813d..98fbbe3b1818e0fac5ceb0e5dd935dfbacc9d2c7 100644 (file)
@@ -101,10 +101,10 @@ public class HelloMessageFactoryTest extends DefaultDeserializerFactoryTest<Hell
                                             + "00 00 00 00"  // padding
                                             );
         HelloMessage builtByFactory = BufferHelper.deserialize(factory, bb);
-        Assert.assertEquals("Wrong - no element has been expected", 0, builtByFactory.getElements().size());
+        Assert.assertEquals("Wrong - no element has been expected", 0, builtByFactory.nonnullElements().size());
     }
 
-    private static List<Elements> createElement(int lengthInByte, int type) {
+    private static List<Elements> createElement(final int lengthInByte, final int type) {
         final ElementsBuilder elementsBuilder = new ElementsBuilder();
         final List<Elements> elementsList = new ArrayList<>();
         List<Boolean> booleanList = new ArrayList<>();
index 4322bd6433a348bddd6acedfd221864541762b1c..dff63a275c94beb9a949fc5370237db0201c800c 100644 (file)
@@ -128,6 +128,6 @@ public class OF10FeaturesReplyMessageFactoryTest {
                 builtByFactory.getCapabilitiesV10());
         Assert.assertEquals("Wrong actions", new ActionTypeV10(false, false, false, false, false, false, false,
                 false, false, false, false, false, false), builtByFactory.getActionsV10());
-        Assert.assertEquals("Wrong ports size", 0, builtByFactory.getPhyPort().size());
+        Assert.assertEquals("Wrong ports size", 0, builtByFactory.nonnullPhyPort().size());
     }
 }
index 9091dbcc1552c6313746c1a240377600a5fded93..4b69ebebf30f46b2e87a559e01ed83e2429c4c4d 100644 (file)
@@ -59,7 +59,7 @@ public class MultipartReplyFlowTest {
         Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
         MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();
         MultipartReplyFlow message = messageCase.getMultipartReplyFlow();
-        Assert.assertEquals("Wrong flow stats size", 0, message.getFlowStats().size());
+        Assert.assertEquals("Wrong flow stats size", 0, message.nonnullFlowStats().size());
     }
 
     /**
index b5fb6b37f41015eb2e1170b36c3bb00356179ccb..bdce9273799b314a6a2bf04f96e7c9257f32d943 100644 (file)
@@ -44,7 +44,7 @@ public class MultipartReplyPortDescTest {
         Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
         MultipartReplyPortDescCase messageCase = (MultipartReplyPortDescCase) builtByFactory.getMultipartReplyBody();
         MultipartReplyPortDesc message = messageCase.getMultipartReplyPortDesc();
-        Assert.assertEquals("Wrong table features size", 0, message.getPorts().size());
+        Assert.assertEquals("Wrong table features size", 0, message.nonnullPorts().size());
     }
 
     /**
index de679d9ef8cebcbf7d225244fccdae131d1b44bf..52276a087eaa89536aa747532b5dce1d420eef3b 100644 (file)
@@ -46,7 +46,7 @@ public class MultipartReplyTableFeaturesTest {
         MultipartReplyTableFeaturesCase messageCase =
                 (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();
         MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();
-        Assert.assertEquals("Wrong table features size", 0, message.getTableFeatures().size());
+        Assert.assertEquals("Wrong table features size", 0, message.nonnullTableFeatures().size());
     }
 
     /**
index 9230d3582a9511753415ac4240cb88adbac94b30..4fda051948aa1ab1e91b2bcb7208c6b7e262e844 100755 (executable)
@@ -242,7 +242,11 @@ public class TransactionChainManager implements TransactionChainListener, AutoCl
                 throw new TransactionChainClosedException(CANNOT_WRITE_INTO_TRANSACTION);
             }
 
-            writeTx.put(store, path, data, createParents);
+            if (createParents) {
+                writeTx.mergeParentStructurePut(store, path, data);
+            } else {
+                writeTx.put(store, path, data);
+            }
         }
     }
 
@@ -257,7 +261,11 @@ public class TransactionChainManager implements TransactionChainListener, AutoCl
                 throw new TransactionChainClosedException(CANNOT_WRITE_INTO_TRANSACTION);
             }
 
-            writeTx.merge(store, path, data, createParents);
+            if (createParents) {
+                writeTx.mergeParentStructureMerge(store, path, data);
+            } else {
+                writeTx.merge(store, path, data);
+            }
         }
     }
 
index 742af3588c24e2ec45abc53d69e24f9ff5ede984..7695b0eddbd59e9d6976d22a8e7c60bdff181a88 100644 (file)
@@ -46,7 +46,7 @@ public class FlowStatsMultipartWriter extends AbstractMultipartWriter<FlowAndSta
 
     @Override
     public void storeStatistics(final FlowAndStatisticsMapList statistics, final boolean withParents) {
-        statistics.getFlowAndStatisticsMapList()
+        statistics.nonnullFlowAndStatisticsMapList().values()
             .forEach(stat -> {
                 final FlowBuilder flow = new FlowBuilder(stat)
                     .addAugmentation(
index c1be2a889e975b7f312463c8c4225977f8cb6b3d..331ba90b6390ab8ff29cf50bcd8efb89a599f4d9 100644 (file)
@@ -38,7 +38,7 @@ public class GroupDescMultipartWriter extends AbstractMultipartWriter<GroupDescS
 
     @Override
     public void storeStatistics(final GroupDescStatsReply statistics, final boolean withParents) {
-        statistics.getGroupDescStats()
+        statistics.nonnullGroupDescStats().values()
             .forEach(stat -> {
                 writeToTransaction(
                     getInstanceIdentifier()
index 80d8446c957388a0f1bb7a08375400c9e1163e94..08d5099fb7c719c6221d612528e538098795a3dc 100755 (executable)
@@ -37,7 +37,7 @@ public class GroupStatsMultipartWriter extends AbstractMultipartWriter<GroupStat
 
     @Override
     public void storeStatistics(final GroupStatisticsReply statistics, final boolean withParents) {
-        statistics.getGroupStats()
+        statistics.nonnullGroupStats().values()
                 .forEach(stat -> {
                     writeToTransaction(
                             getInstanceIdentifier()
index ef24c9d0f0044b7fc05761613cd04e0336490ef2..8dba87b2ff742b836a7b73ea3fb19a7972142ad8 100644 (file)
@@ -38,7 +38,7 @@ public class MeterConfigMultipartWriter extends AbstractMultipartWriter<MeterCon
 
     @Override
     public void storeStatistics(final MeterConfigStatsReply statistics, final boolean withParents) {
-        statistics.getMeterConfigStats()
+        statistics.nonnullMeterConfigStats().values()
             .forEach(stat -> {
                 writeToTransaction(
                     getInstanceIdentifier()
index 5abd7850fc979254525b30625a5611dd2006d6fb..9ae90ba698c7378972db190e841d90574b67a2a6 100644 (file)
@@ -32,7 +32,7 @@ public class MeterStatsMultipartWriter extends AbstractMultipartWriter<MeterStat
 
     @Override
     public void storeStatistics(final MeterStatisticsReply statistics, final boolean withParents) {
-        statistics.getMeterStats()
+        statistics.nonnullMeterStats().values()
             .forEach(stat -> writeToTransaction(
                 getInstanceIdentifier()
                     .augmentation(FlowCapableNode.class)
index d7ba87d282df678c94415c3c0665f1b62649f1d8..28e9dbdb5ce4616506c26ac1a2bab96b8ca1c036 100644 (file)
@@ -42,7 +42,7 @@ public class PortStatsMultipartWriter extends AbstractMultipartWriter<NodeConnec
 
     @Override
     public void storeStatistics(final NodeConnectorStatisticsAndPortNumberMap statistics, final boolean withParents) {
-        statistics.getNodeConnectorStatisticsAndPortNumberMap()
+        statistics.nonnullNodeConnectorStatisticsAndPortNumberMap().values()
             .forEach(stat -> {
                 final OpenflowVersion openflowVersion = OpenflowVersion.get(features.getVersion());
                 final Uint32 port = InventoryDataServiceUtil.portNumberfromNodeConnectorId(openflowVersion,
index 61eab1453afc16643be86817e6ff1842aaa96b2d..9d902e2ac1378b501e0f3515b4a7c2fe4cab3e71 100644 (file)
@@ -47,7 +47,7 @@ public class QueueStatsMultipartWriter extends AbstractMultipartWriter<QueueIdAn
     public void storeStatistics(final QueueIdAndStatisticsMap statistics, final boolean withParents) {
         final OpenflowVersion openflowVersion = OpenflowVersion.get(features.getVersion());
 
-        statistics.getQueueIdAndStatisticsMap()
+        statistics.nonnullQueueIdAndStatisticsMap().values()
             .forEach((stat) -> {
                 final Uint32 port = InventoryDataServiceUtil
                         .portNumberfromNodeConnectorId(openflowVersion, stat.getNodeConnectorId());
index f839ac352e7ed4aaab8fd597f3713afb9096105d..89d21546e2c731260e1b477b45bedafa7222bf60 100644 (file)
@@ -34,7 +34,7 @@ public class TableFeaturesMultipartWriter extends AbstractMultipartWriter<TableF
 
     @Override
     public void storeStatistics(final TableFeatures statistics, final boolean withParents) {
-        statistics.getTableFeatures()
+        statistics.nonnullTableFeatures().values()
             .forEach(stat -> {
                 writeToTransaction(getInstanceIdentifier()
                         .augmentation(FlowCapableNode.class)
index 95758ab9060cb261f6930ec7aefa4b1e5d8df0b2..9e7adafeaf5f188f83f48e9ada28b75d218eba50 100644 (file)
@@ -33,7 +33,7 @@ public class TableStatsMultipartWriter extends AbstractMultipartWriter<FlowTable
     @Override
     public void storeStatistics(final FlowTableAndStatisticsMap statistics,
                                 final boolean withParents) {
-        statistics.getFlowTableAndStatisticsMap()
+        statistics.nonnullFlowTableAndStatisticsMap().values()
             .forEach(stat -> writeToTransaction(
                 getInstanceIdentifier()
                     .augmentation(FlowCapableNode.class)
index b9ba54865411f0530962a6718973151d43fea283..80da7d4174e5455b6a64eac00ce3e22d89c1bb01 100644 (file)
@@ -764,9 +764,9 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
                 if (result != null) {
                     for (Optional<FlowCapableNode> optNode : result) {
                         if (optNode.isPresent()) {
-                            flowCount += optNode.get().nonnullTable().stream()
+                            flowCount += optNode.get().nonnullTable().values().stream()
                                     .filter(Objects::nonNull)
-                                    .flatMap(table -> table.nonnullFlow().stream())
+                                    .flatMap(table -> table.nonnullFlow().values().stream())
                                     .filter(Objects::nonNull)
                                     .count();
                         }
index 4393b96537ecd575d075f3dd05702a1bf8c8d1fa..f9f4eaac9899bebf82a03b7333a89a0b3850fea1 100644 (file)
@@ -216,8 +216,7 @@ public class ContextChainHolderImpl implements ContextChainHolder, MasterChecker
     }
 
     @Override
-    public void onNotAbleToStartMastership(@NonNull final DeviceInfo deviceInfo, @NonNull final String reason,
-                                           final boolean mandatory) {
+    public void onNotAbleToStartMastership(final DeviceInfo deviceInfo, final String reason, final boolean mandatory) {
         LOG.warn("Not able to set MASTER role on device {}, reason: {}", deviceInfo, reason);
 
         if (!mandatory) {
@@ -232,8 +231,7 @@ public class ContextChainHolderImpl implements ContextChainHolder, MasterChecker
     }
 
     @Override
-    public void onMasterRoleAcquired(@NonNull final DeviceInfo deviceInfo,
-                                     @NonNull final ContextChainMastershipState mastershipState) {
+    public void onMasterRoleAcquired(final DeviceInfo deviceInfo, final ContextChainMastershipState mastershipState) {
         Optional.ofNullable(contextChainMap.get(deviceInfo)).ifPresent(contextChain -> {
             if (!ContextChainMastershipState.INITIAL_SUBMIT.equals(mastershipState)) {
                 if (contextChain.isMastered(mastershipState, true)) {
index e1e0679ef5e419387cf17fea44f83c9dd6b678cf..f7fcc9641b54175b023e67ab871446d65c540a29 100644 (file)
@@ -16,6 +16,7 @@ import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegi
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.BandId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterBandType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
@@ -27,6 +28,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.MeterBandHeadersBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeader;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeaderBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeaderKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.meter.band.header.MeterBandTypesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterModCommand;
 import org.slf4j.Logger;
@@ -51,6 +53,7 @@ public class MeterMessageDeserializer implements OFDeserializer<MeterMessage>, D
                 .setMeterId(new MeterId(message.readUnsignedInt()));
 
         final List<MeterBandHeader> bands = new ArrayList<>();
+        long key = 0;
 
         while (message.readableBytes() > 0) {
             final MeterBandHeaderBuilder bandBuilder = new MeterBandHeaderBuilder();
@@ -104,7 +107,7 @@ public class MeterMessageDeserializer implements OFDeserializer<MeterMessage>, D
                     // no operation
             }
 
-            bands.add(bandBuilder.build());
+            bands.add(bandBuilder.withKey(new MeterBandHeaderKey(new BandId(key++))).build());
         }
 
         return builder
index 694ab0beff9d9460368d45cb4a4ab25e26bf2d21..8f944e0532e642811a380892294bc67fe7a9e23f 100644 (file)
@@ -25,8 +25,10 @@ import org.opendaylight.openflowplugin.impl.protocol.deserialization.util.Instru
 import org.opendaylight.openflowplugin.impl.util.MatchUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowStatsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
@@ -52,6 +54,7 @@ public class MultipartReplyFlowStatsDeserializer implements OFDeserializer<Multi
     public MultipartReplyBody deserialize(ByteBuf message) {
         final MultipartReplyFlowStatsBuilder builder = new MultipartReplyFlowStatsBuilder();
         final List<FlowAndStatisticsMapList> items = new ArrayList<>();
+        int key = 0;
 
         while (message.readableBytes() > 0) {
             final FlowAndStatisticsMapListBuilder itemBuilder = new FlowAndStatisticsMapListBuilder();
@@ -115,6 +118,7 @@ public class MultipartReplyFlowStatsDeserializer implements OFDeserializer<Multi
                         .build());
             }
 
+            itemBuilder.withKey(new FlowAndStatisticsMapListKey(new FlowId(String.valueOf(key++))));
             items.add(itemBuilder.build());
         }
 
index 49b5e7e9c77751f6c2b86c8161fe658ffcc7eeb6..c67ee0e627fe1f68238a1de491f2531d8f0f79bb 100644 (file)
@@ -37,11 +37,11 @@ public abstract class AbstractActionInstructionSerializer<T extends Instruction>
      * @param startIndex start index of byte buffer
      */
     protected void writeActions(ActionList actions, short version, ByteBuf outBuffer, int startIndex) {
-        Optional.ofNullable(actions).flatMap(as -> Optional.ofNullable(as.getAction())).map(as -> {
+        Optional.ofNullable(actions).flatMap(as -> Optional.ofNullable(as.nonnullAction())).map(as -> {
             final int lengthIndex = outBuffer.writerIndex();
             outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);
             outBuffer.writeZero(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
-            as.stream().sorted(OrderComparator.build()).forEach(a -> ActionUtil
+            as.values().stream().sorted(OrderComparator.build()).forEach(a -> ActionUtil
                     .writeAction(a.getAction(), version, registry, outBuffer));
             outBuffer.setShort(lengthIndex, outBuffer.writerIndex() - startIndex);
             return actions;
index 8586446f1006de9c3a3799886b2a11caaeec8651..ecbffaaf69f24b50fa82a8c93f53c8e40d9b8bd4 100644 (file)
@@ -8,8 +8,8 @@
 package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
 
 import io.netty.buffer.ByteBuf;
+import java.util.Collection;
 import java.util.LinkedHashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
@@ -43,7 +43,7 @@ public class MatchSerializer implements OFSerializer<Match>, HeaderSerializer<Ma
     private SerializerRegistry registry;
 
     @Override
-    public void serialize(Match match, ByteBuf outBuffer) {
+    public void serialize(final Match match, final ByteBuf outBuffer) {
         // Save start index in buffer
         final int matchStartIndex = outBuffer.writerIndex();
 
@@ -70,7 +70,7 @@ public class MatchSerializer implements OFSerializer<Match>, HeaderSerializer<Ma
     }
 
     @Override
-    public void serializeHeader(Match match, ByteBuf outBuffer) {
+    public void serializeHeader(final Match match, final ByteBuf outBuffer) {
         if (match == null) {
             LOG.debug("Match is null, skipping serialization of match entries");
             return;
@@ -83,11 +83,11 @@ public class MatchSerializer implements OFSerializer<Match>, HeaderSerializer<Ma
         ExtensionResolvers
                 .getMatchExtensionResolver()
                 .getExtension(match)
-                .flatMap(extensions -> Optional.ofNullable(extensions.getExtensionList()))
-                .ifPresent(extensionList -> serializeExtensionList(extensionList, outBuffer));
+                .flatMap(extensions -> Optional.ofNullable(extensions.nonnullExtensionList()))
+                .ifPresent(extensionList -> serializeExtensionList(extensionList.values(), outBuffer));
     }
 
-    private void serializeExtensionList(final List<ExtensionList> extensionList, final ByteBuf outBuffer) {
+    private void serializeExtensionList(final Collection<ExtensionList> extensionList, final ByteBuf outBuffer) {
         // TODO: Remove also extension converters
         extensionList.forEach(extension -> {
             final ConverterExtensionKey<? extends ExtensionKey> converterExtensionKey =
@@ -121,13 +121,14 @@ public class MatchSerializer implements OFSerializer<Match>, HeaderSerializer<Ma
     }
 
     @Override
-    public void injectSerializerRegistry(SerializerRegistry serializerRegistry) {
+    public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
         registry = serializerRegistry;
     }
 
     @Override
-    public void registerEntrySerializer(org.opendaylight.openflowplugin.api.openflow.protocol.serialization
-                                                    .MatchEntrySerializerKey key, MatchEntrySerializer serializer) {
+    public void registerEntrySerializer(
+            final org.opendaylight.openflowplugin.api.openflow.protocol.serialization.MatchEntrySerializerKey key,
+            final MatchEntrySerializer serializer) {
         if (key == null || serializer == null) {
             throw new IllegalArgumentException("MatchEntrySerializerKey or Serializer is null");
         }
@@ -140,8 +141,8 @@ public class MatchSerializer implements OFSerializer<Match>, HeaderSerializer<Ma
     }
 
     @Override
-    public boolean unregisterEntrySerializer(org.opendaylight.openflowplugin.api.openflow.protocol.serialization
-                                                         .MatchEntrySerializerKey key) {
+    public boolean unregisterEntrySerializer(
+            final org.opendaylight.openflowplugin.api.openflow.protocol.serialization.MatchEntrySerializerKey key) {
         return entryRegistry.remove(key) != null;
     }
 }
index d61ad35b1193b59ffa456a9359e23719a574d8e5..b1820141d89b535aa6ac6ab607c80bbb2f64b610 100644 (file)
@@ -11,7 +11,6 @@ import com.google.common.base.MoreObjects;
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 import java.util.Objects;
 import java.util.Optional;
@@ -38,6 +37,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowMessage;
@@ -181,7 +181,6 @@ public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage
      * @param message   OpenFlow flow mod message
      * @param outBuffer output buffer
      */
-    @SuppressWarnings("unchecked")
     private void writeInstructions(final FlowMessage message, final ByteBuf outBuffer) {
         // Try to get IP protocol from IP match
         final Optional<Uint8> protocol = Optional
@@ -191,8 +190,8 @@ public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage
 
         // Update instructions if needed and then serialize all instructions
         Optional.ofNullable(message.getInstructions())
-                .flatMap(is -> Optional.ofNullable(is.getInstruction()))
-                .ifPresent(is -> is.stream()
+                .flatMap(is -> Optional.ofNullable(is.nonnullInstruction()))
+                .ifPresent(is -> is.values().stream()
                         .filter(Objects::nonNull)
                         .sorted(OrderComparator.build())
                         .map(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types
@@ -214,10 +213,11 @@ public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage
         if (instruction instanceof ApplyActionsCase) {
             return Optional
                     .ofNullable(((ApplyActionsCase) instruction).getApplyActions())
-                    .flatMap(aa -> Optional.ofNullable(aa.getAction()))
+                    .flatMap(aa -> Optional.ofNullable(aa.nonnullAction()))
                     .map(as -> new ApplyActionsCaseBuilder()
                             .setApplyActions(new ApplyActionsBuilder()
                                     .setAction(as
+                                            .values()
                                             .stream()
                                             .filter(Objects::nonNull)
                                             .map(a -> updateSetTpActions(a, protocol))
@@ -276,7 +276,7 @@ public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage
      */
     private static List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list
             .Instruction> updateSetVlanIdAction(final FlowMessage message) {
-        return message.getInstructions().getInstruction()
+        return message.getInstructions().nonnullInstruction().values()
                 .stream()
                 .map(i -> {
                     final int[] offset = {0};
@@ -284,8 +284,8 @@ public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage
                     return i.getInstruction() instanceof ApplyActionsCase
                             ? Optional
                             .ofNullable(((ApplyActionsCase) i.getInstruction()).getApplyActions())
-                            .flatMap(as -> Optional.ofNullable(as.getAction()))
-                            .map(a -> a.stream()
+                            .flatMap(as -> Optional.ofNullable(as.nonnullAction()))
+                            .map(a -> a.values().stream()
                                     .sorted(OrderComparator.build())
                                     .flatMap(action -> {
                                         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
@@ -315,6 +315,7 @@ public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage
                                         // Update offset of action if there is any inserted PushVlan actions
                                         actions.add(offset[0] > 0
                                                 ? new ActionBuilder(action).setOrder(action.getOrder() + offset[0])
+                                                .withKey(new ActionKey(action.getOrder() + offset[0]))
                                                 .build()
                                                 : action);
 
@@ -374,16 +375,16 @@ public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage
     private static boolean isSetVlanIdActionCasePresent(final Flow flow) {
         return Optional
                 .ofNullable(flow.getInstructions())
-                .flatMap(is -> Optional.ofNullable(is.getInstruction()))
-                .flatMap(is -> is.stream()
+                .flatMap(is -> Optional.ofNullable(is.nonnullInstruction()))
+                .flatMap(is -> is.values().stream()
                         .map(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types
                                 .rev131026.Instruction::getInstruction)
                         .filter(ApplyActionsCase.class::isInstance)
                         .map(i -> ((ApplyActionsCase) i).getApplyActions())
                         .filter(Objects::nonNull)
-                        .map(ActionList::getAction)
+                        .map(ActionList::nonnullAction)
                         .filter(Objects::nonNull)
-                        .flatMap(Collection::stream)
+                        .flatMap(map -> map.values().stream())
                         .map(Action::getAction)
                         .filter(SetVlanIdActionCase.class::isInstance)
                         .findFirst())
index 6593c307dc2c3378601a8ee1fcff5bcef55021d3..f46b3da8df01059d112ebd7709f6776aba66a43c 100644 (file)
@@ -66,8 +66,8 @@ public class GroupMessageSerializer extends AbstractMessageSerializer<GroupMessa
 
         Optional.ofNullable(message.getBuckets())
             .filter(b -> !GroupModCommand.OFPGCDELETE.equals(message.getCommand()))
-            .flatMap(b -> Optional.ofNullable(b.getBucket()))
-            .ifPresent(b -> b.stream()
+            .flatMap(b -> Optional.ofNullable(b.nonnullBucket()))
+            .ifPresent(b -> b.values().stream()
                 .sorted(COMPARATOR)
                 .forEach(bucket -> {
                     final int bucketIndex = outBuffer.writerIndex();
@@ -79,7 +79,7 @@ public class GroupMessageSerializer extends AbstractMessageSerializer<GroupMessa
                             .intValue());
                     outBuffer.writeZero(PADDING_IN_BUCKET);
 
-                    Optional.ofNullable(bucket.getAction()).ifPresent(as -> as
+                    Optional.ofNullable(bucket.nonnullAction()).ifPresent(as -> as.values()
                             .stream()
                             .sorted(OrderComparator.build())
                             .forEach(a -> ActionUtil.writeAction(
index bcf92cbbed8e9d08c49fad03f350253ecfdc6418..8b440169022d68170dbd02324702caaa9b5e299f 100644 (file)
@@ -58,7 +58,7 @@ public class MeterMessageSerializer extends AbstractMessageSerializer<MeterMessa
 
     private void serializeBands(final MeterBandHeaders meterBandHeaders, final ByteBuf outBuffer) {
         if (meterBandHeaders != null && meterBandHeaders.getMeterBandHeader() != null) {
-            meterBandHeaders.getMeterBandHeader().forEach(meterBandHeader ->
+            meterBandHeaders.nonnullMeterBandHeader().values().forEach(meterBandHeader ->
                     Optional.ofNullable(meterBandHeader.getMeterBandTypes())
                             .flatMap(m -> Optional.ofNullable(m.getFlags()))
                             .ifPresent(flags -> Optional.ofNullable(meterBandHeader.getBandType()).ifPresent(type -> {
index 3939f8a14ecb4c902285d3808d2359f706d5750f..66b4c50322f663e9130a37d46238b22a4cab8132 100644 (file)
@@ -32,8 +32,8 @@ public class MultipartRequestTableFeaturesSerializer implements OFSerializer<Mul
     @Override
     public void serialize(final MultipartRequestTableFeatures multipartRequestTableFeatures, final ByteBuf byteBuf) {
         Optional
-            .ofNullable(multipartRequestTableFeatures.getTableFeatures())
-            .ifPresent(tableFeatures -> tableFeatures
+            .ofNullable(multipartRequestTableFeatures.nonnullTableFeatures())
+            .ifPresent(tableFeatures -> tableFeatures.values()
                 .stream()
                 .filter(Objects::nonNull)
                 .forEach(tableFeature -> {
@@ -56,8 +56,8 @@ public class MultipartRequestTableFeaturesSerializer implements OFSerializer<Mul
     private void serializeProperties(final TableProperties tableProperties, final ByteBuf byteBuf) {
         Optional
             .ofNullable(tableProperties)
-            .flatMap(properties -> Optional.ofNullable(properties.getTableFeatureProperties()))
-            .ifPresent(properties -> properties
+            .flatMap(properties -> Optional.ofNullable(properties.nonnullTableFeatureProperties()))
+            .ifPresent(properties -> properties.values()
                 .stream()
                 .filter(Objects::nonNull)
                 .forEach(property -> {
index 23969502185ee1896a35fc75ccf6af608d8367e1..52734f8e5c600e5225d8e787811f6568669bdec3 100644 (file)
@@ -27,7 +27,7 @@ public class ApplyActionsMissTablePropertySerializer extends
     protected void serializeProperty(final ApplyActionsMiss property, final ByteBuf byteBuf) {
         property
                 .getApplyActionsMiss()
-                .getAction()
+                .nonnullAction().values()
                 .stream()
                 .sorted(OrderComparator.build())
                 .map(Action::getAction)
index 796fee6b91bf3532dd47614ba980f827e98f58b9..2bda2d9ebadf78bc62b3452811141a42d14e7e9a 100644 (file)
@@ -27,7 +27,8 @@ public class ApplyActionsTablePropertySerializer extends AbstractTablePropertySe
     protected void serializeProperty(final ApplyActions property, final ByteBuf byteBuf) {
         property
                 .getApplyActions()
-                .getAction()
+                .nonnullAction()
+                .values()
                 .stream()
                 .sorted(OrderComparator.build())
                 .map(Action::getAction)
index 8d79ffcea8539cc39f0e8da7cff43193aaf7789a..22a51ec358990a197f76a35c6a1888f2a1382108 100644 (file)
@@ -29,7 +29,7 @@ public class ApplySetfieldMissTablePropertySerializer extends
     protected void serializeProperty(final ApplySetfieldMiss property, final ByteBuf byteBuf) {
         property
             .getApplySetfieldMiss()
-            .getSetFieldMatch()
+            .nonnullSetFieldMatch().values()
             .forEach(setFieldMatch -> Preconditions.checkNotNull(registry)
                 .<MatchField, OFSerializer<SetFieldMatch>>getSerializer(
                     new MessageTypeKey<>(
index 0d09e54b5c98e40d51b4cf3a2eed9a68ea16c6b9..0ce17c1d8ad0ab86f036c330d44a98967aef1a41 100644 (file)
@@ -29,7 +29,7 @@ public class ApplySetfieldTablePropertySerializer extends AbstractTablePropertyS
     protected void serializeProperty(final ApplySetfield property, final ByteBuf byteBuf) {
         property
             .getApplySetfield()
-            .getSetFieldMatch()
+            .nonnullSetFieldMatch().values()
             .forEach(setFieldMatch -> Preconditions.checkNotNull(registry)
                 .<MatchField, OFSerializer<SetFieldMatch>>getSerializer(
                     new MessageTypeKey<>(
index ad855a0d96f1e66d1b8532a8e0ea392dac0929e3..6c97371bc5831e6cf009da9ecf46febde1209862 100644 (file)
@@ -27,8 +27,8 @@ public class InstructionsMissTablePropertySerializer extends
     protected void serializeProperty(final InstructionsMiss property, final ByteBuf byteBuf) {
         property
                 .getInstructionsMiss()
-                .getInstruction()
-                .stream()
+                .nonnullInstruction()
+                .values().stream()
                 .sorted(OrderComparator.build())
                 .map(Instruction::getInstruction)
                 .forEach(instruction -> InstructionUtil
index b4ed106ce11b8499e2bb6c8ceb64879cbbb36add..cf900fb0583398b9b6dc4acd742506ea0b346949 100644 (file)
@@ -27,7 +27,7 @@ public class InstructionsTablePropertySerializer extends AbstractTablePropertySe
     protected void serializeProperty(final Instructions property, final ByteBuf byteBuf) {
         property
                 .getInstructions()
-                .getInstruction()
+                .nonnullInstruction().values()
                 .stream()
                 .sorted(OrderComparator.build())
                 .map(Instruction::getInstruction)
index 55de662876dc4ada38d9042ada69ff408ff71414..cf7072137c378554516be75ae03bd48af4d3a700 100644 (file)
@@ -29,7 +29,7 @@ public class MatchTablePropertySerializer extends AbstractTablePropertySerialize
     protected void serializeProperty(final Match property, final ByteBuf byteBuf) {
         property
             .getMatchSetfield()
-            .getSetFieldMatch()
+            .nonnullSetFieldMatch().values()
             .forEach(setFieldMatch -> Preconditions.checkNotNull(registry)
                 .<MatchField, OFSerializer<SetFieldMatch>>getSerializer(
                     new MessageTypeKey<>(
index f7f24aa1de9071969dc187e79fb39cf9a07c0421..88c01dd3bbfe7d47ad2c088323a71eeb5c558fea 100644 (file)
@@ -29,7 +29,7 @@ public class WildcardsTablePropertySerializer extends AbstractTablePropertySeria
     protected void serializeProperty(final Wildcards property, final ByteBuf byteBuf) {
         property
             .getWildcardSetfield()
-            .getSetFieldMatch()
+            .nonnullSetFieldMatch().values()
             .forEach(setFieldMatch -> Preconditions.checkNotNull(registry)
                 .<MatchField, OFSerializer<SetFieldMatch>>getSerializer(
                     new MessageTypeKey<>(
index 437aadbc36269d4766d183dd6f36c679d2a2a9f1..30bd3d874b419a7f1d60db1e83c1792d8edc3b4b 100644 (file)
@@ -27,7 +27,7 @@ public class WriteActionsMissTablePropertySerializer extends
     protected void serializeProperty(final WriteActionsMiss property, final ByteBuf byteBuf) {
         property
                 .getWriteActionsMiss()
-                .getAction()
+                .nonnullAction().values()
                 .stream()
                 .sorted(OrderComparator.build())
                 .map(Action::getAction)
index 5b9d2f3c9cc13f745891d1721533fd11a530cc66..f990fba6ce3602f5d815086570e0e0c0e55f7bd4 100644 (file)
@@ -27,7 +27,8 @@ public class WriteActionsTablePropertySerializer extends AbstractTablePropertySe
     protected void serializeProperty(final WriteActions property, final ByteBuf byteBuf) {
         property
                 .getWriteActions()
-                .getAction()
+                .nonnullAction()
+                .values()
                 .stream()
                 .sorted(OrderComparator.build())
                 .map(Action::getAction)
index 02f7e34e81e871c58f189f23ada440e1cf1676f9..ce8d2bee75900a0869d533eb384d15310667f73c 100644 (file)
@@ -29,7 +29,7 @@ public class WriteSetfieldMissTablePropertySerializer extends
     protected void serializeProperty(final WriteSetfieldMiss property, final ByteBuf byteBuf) {
         property
             .getWriteSetfieldMiss()
-            .getSetFieldMatch()
+            .nonnullSetFieldMatch().values()
             .forEach(setFieldMatch -> Preconditions.checkNotNull(registry)
                 .<MatchField, OFSerializer<SetFieldMatch>>getSerializer(
                     new MessageTypeKey<>(
index fe571b6200f21a41da180bb753b69f41e1a4b090..d69e7a0805ce929daf7e2a2b076735d2dece0bf3 100644 (file)
@@ -29,7 +29,7 @@ public class WriteSetfieldTablePropertySerializer extends AbstractTablePropertyS
     protected void serializeProperty(final WriteSetfield property, final ByteBuf byteBuf) {
         property
             .getWriteSetfield()
-            .getSetFieldMatch()
+            .nonnullSetFieldMatch().values()
             .forEach(setFieldMatch -> Preconditions.checkNotNull(registry)
                 .<MatchField, OFSerializer<SetFieldMatch>>getSerializer(
                     new MessageTypeKey<>(
index a71a738ecc7272bb896c2153c80acee7dd8a0de4..0fee0d39aadaeda0f5280055282574e5ee43514b 100644 (file)
@@ -116,9 +116,9 @@ public class DeviceFlowRegistryImpl implements DeviceFlowRegistry {
             @Override
             public void onSuccess(final Optional<FlowCapableNode> result) {
                 result.ifPresent(flowCapableNode -> {
-                    flowCapableNode.nonnullTable().stream()
+                    flowCapableNode.nonnullTable().values().stream()
                     .filter(Objects::nonNull)
-                    .flatMap(table -> table.nonnullFlow().stream())
+                    .flatMap(table -> table.nonnullFlow().values().stream())
                     .filter(Objects::nonNull)
                     .filter(flow -> flow.getId() != null)
                     .forEach(flowConsumer);
index 05f18c2396c95af670f3237b4f8b6b566c8e49e9..f796080517503f24283d979faf8b1f6c1bf55c0e 100644 (file)
@@ -122,8 +122,8 @@ public final class FlowRegistryKeyFactory {
                     if (!Objects.equals(match.getVlanMatch(), input.getVlanMatch())) {
                         return false;
                     }
-                    for (ExtensionList inputExtensionList : inputAug.getExtensionList()) {
-                        if (!thisAug.getExtensionList().contains(inputExtensionList)) {
+                    for (ExtensionList inputExtensionList : inputAug.nonnullExtensionList().values()) {
+                        if (!thisAug.nonnullExtensionList().containsValue(inputExtensionList)) {
                             return false;
                         }
                     }
index a146d8bda3b199657b66e8581595399f23c8a0f0..0181afee89fbb6c0292fd472ed99fd89f902f84d 100644 (file)
@@ -28,7 +28,7 @@ public abstract class AbstractRequestCallback<T> implements FutureCallback<OfHea
     private final RequestContext<T> context;
     private final Class<?> requestType;
     private final MessageSpy spy;
-    private EventIdentifier eventIdentifier;
+    private final EventIdentifier eventIdentifier;
 
     AbstractRequestCallback(final RequestContext<T> context,
                             final Class<?> requestType,
@@ -54,7 +54,7 @@ public abstract class AbstractRequestCallback<T> implements FutureCallback<OfHea
     }
 
     @Override
-    public final void onFailure(@NonNull final Throwable throwable) {
+    public final void onFailure(final Throwable throwable) {
         final RpcResultBuilder<T> builder;
         if (null != eventIdentifier) {
             EventsTimeCounter.markEnd(eventIdentifier);
index 943d61a556abe0daafcdba67680c682e1f88fbb4..ef734d242f4df4ccb4062c4b41acb9167a2cae07 100644 (file)
@@ -141,7 +141,7 @@ public final class FlatBatchFlowAdapters {
             final RpcResult<T> input, final int stepOffset) {
         final List<BatchFailure> batchFailures = new ArrayList<>();
         if (input.getResult().getBatchFailedFlowsOutput() != null) {
-            for (BatchFailedFlowsOutput stepOutput : input.getResult().getBatchFailedFlowsOutput()) {
+            for (BatchFailedFlowsOutput stepOutput : input.getResult().nonnullBatchFailedFlowsOutput().values()) {
                 final BatchFailure batchFailure = new BatchFailureBuilder()
                         .setBatchOrder(stepOffset + stepOutput.getBatchOrder().toJava())
                         .setBatchItemIdChoice(new FlatBatchFailureFlowIdCaseBuilder()
index 90d4c6805adf78f941751f4ec13ec40482f9a5fa..5ea9999fac0bd8f1c75fefb692b2a134e57b0173 100644 (file)
@@ -140,7 +140,7 @@ public final class FlatBatchGroupAdapters {
             final RpcResult<T> input, final int stepOffset) {
         final List<BatchFailure> batchFailures = new ArrayList<>();
         if (input.getResult().getBatchFailedGroupsOutput() != null) {
-            for (BatchFailedGroupsOutput stepOutput : input.getResult().getBatchFailedGroupsOutput()) {
+            for (BatchFailedGroupsOutput stepOutput : input.getResult().nonnullBatchFailedGroupsOutput().values()) {
                 final BatchFailure batchFailure = new BatchFailureBuilder()
                         .setBatchOrder(stepOffset + stepOutput.getBatchOrder().toJava())
                         .setBatchItemIdChoice(new FlatBatchFailureGroupIdCaseBuilder()
index f679823eda20917410f5407b45d9377fb86df4bb..85fdacfd9f378d605682382cadc94d6a9b9f7189 100644 (file)
@@ -140,7 +140,7 @@ public final class FlatBatchMeterAdapters {
             final RpcResult<T> input, final int stepOffset) {
         final List<BatchFailure> batchFailures = new ArrayList<>();
         if (input.getResult().getBatchFailedMetersOutput() != null) {
-            for (BatchFailedMetersOutput stepOutput : input.getResult().getBatchFailedMetersOutput()) {
+            for (BatchFailedMetersOutput stepOutput : input.getResult().nonnullBatchFailedMetersOutput().values()) {
                 final BatchFailure batchFailure = new BatchFailureBuilder()
                         .setBatchOrder(stepOffset + stepOutput.getBatchOrder().toJava())
                         .setBatchItemIdChoice(new FlatBatchFailureMeterIdCaseBuilder()
index f4e0c4be800aa74e1f3ff14bc72cc31c1357a150..f61665e406417763c93ed2018c6a6e62ec8be7a2 100644 (file)
@@ -78,7 +78,7 @@ public class SalFlatBatchServiceImpl implements SalFlatBatchService {
                   PathUtil.extractNodeId(input.getNode()).getValue(),
                   input.getBatch().size());
         // create plan
-        final List<BatchPlanStep> batchPlan = FlatBatchUtil.assembleBatchPlan(input.getBatch());
+        final List<BatchPlanStep> batchPlan = FlatBatchUtil.assembleBatchPlan(input.nonnullBatch().values());
         // add barriers where needed
         FlatBatchUtil.markBarriersWhereNeeded(batchPlan);
         // prepare chain elements
index cbc28902edd1c2d9d851955bb1c27c1291355e74..40245358f9c699cbab511fa87b06edc919d549ce 100644 (file)
@@ -70,7 +70,7 @@ public class SalFlowsBatchServiceImpl implements SalFlowsBatchService {
                   PathUtil.extractNodeId(input.getNode()),
                   input.getBatchRemoveFlows().size());
         final ArrayList<ListenableFuture<RpcResult<RemoveFlowOutput>>> resultsLot = new ArrayList<>();
-        for (BatchFlowInputGrouping batchFlow : input.getBatchRemoveFlows()) {
+        for (BatchFlowInputGrouping batchFlow : input.nonnullBatchRemoveFlows().values()) {
             final RemoveFlowInput removeFlowInput = new RemoveFlowInputBuilder(batchFlow)
                     .setFlowRef(createFlowRef(input.getNode(), batchFlow))
                     .setNode(input.getNode())
@@ -80,7 +80,7 @@ public class SalFlowsBatchServiceImpl implements SalFlowsBatchService {
 
         final ListenableFuture<RpcResult<List<BatchFailedFlowsOutput>>> commonResult =
                 Futures.transform(Futures.successfulAsList(resultsLot),
-                        FlowUtil.createCumulatingFunction(input.getBatchRemoveFlows()),
+                        FlowUtil.createCumulatingFunction(input.nonnullBatchRemoveFlows().values()),
                         MoreExecutors.directExecutor());
 
         ListenableFuture<RpcResult<RemoveFlowsBatchOutput>> removeFlowsBulkFuture =
@@ -98,7 +98,7 @@ public class SalFlowsBatchServiceImpl implements SalFlowsBatchService {
     public ListenableFuture<RpcResult<AddFlowsBatchOutput>> addFlowsBatch(final AddFlowsBatchInput input) {
         LOG.trace("Adding flows @ {} : {}", PathUtil.extractNodeId(input.getNode()), input.getBatchAddFlows().size());
         final ArrayList<ListenableFuture<RpcResult<AddFlowOutput>>> resultsLot = new ArrayList<>();
-        for (BatchFlowInputGrouping batchFlow : input.getBatchAddFlows()) {
+        for (BatchFlowInputGrouping batchFlow : input.nonnullBatchAddFlows().values()) {
             final AddFlowInput addFlowInput = new AddFlowInputBuilder(batchFlow)
                     .setFlowRef(createFlowRef(input.getNode(), batchFlow))
                     .setNode(input.getNode())
@@ -108,7 +108,7 @@ public class SalFlowsBatchServiceImpl implements SalFlowsBatchService {
 
         final ListenableFuture<RpcResult<List<BatchFailedFlowsOutput>>> commonResult =
                 Futures.transform(Futures.successfulAsList(resultsLot),
-                        FlowUtil.createCumulatingFunction(input.getBatchAddFlows()),
+                        FlowUtil.createCumulatingFunction(input.nonnullBatchAddFlows().values()),
                         MoreExecutors.directExecutor());
 
         ListenableFuture<RpcResult<AddFlowsBatchOutput>> addFlowsBulkFuture =
@@ -138,7 +138,7 @@ public class SalFlowsBatchServiceImpl implements SalFlowsBatchService {
                   PathUtil.extractNodeId(input.getNode()),
                   input.getBatchUpdateFlows().size());
         final ArrayList<ListenableFuture<RpcResult<UpdateFlowOutput>>> resultsLot = new ArrayList<>();
-        for (BatchUpdateFlows batchFlow : input.getBatchUpdateFlows()) {
+        for (BatchUpdateFlows batchFlow : input.nonnullBatchUpdateFlows().values()) {
             final UpdateFlowInput updateFlowInput = new UpdateFlowInputBuilder(input)
                     .setOriginalFlow(new OriginalFlowBuilder(batchFlow.getOriginalBatchedFlow()).build())
                     .setUpdatedFlow(new UpdatedFlowBuilder(batchFlow.getUpdatedBatchedFlow()).build())
@@ -150,7 +150,7 @@ public class SalFlowsBatchServiceImpl implements SalFlowsBatchService {
 
         final ListenableFuture<RpcResult<List<BatchFailedFlowsOutput>>> commonResult =
                 Futures.transform(Futures.successfulAsList(resultsLot),
-                                  FlowUtil.createCumulatingFunction(input.getBatchUpdateFlows()),
+                                  FlowUtil.createCumulatingFunction(input.nonnullBatchUpdateFlows().values()),
                         MoreExecutors.directExecutor());
 
         ListenableFuture<RpcResult<UpdateFlowsBatchOutput>> updateFlowsBulkFuture =
index fcfd26c788f49d57f5424ec3f202810d9c8e4bf5..7cf3c4dc0e7ca21884bc51e0dc2dc583b1db6c73 100644 (file)
@@ -106,7 +106,7 @@ public class SalGroupsBatchServiceImpl implements SalGroupsBatchService {
     public ListenableFuture<RpcResult<AddGroupsBatchOutput>> addGroupsBatch(final AddGroupsBatchInput input) {
         LOG.trace("Adding groups @ {} : {}", PathUtil.extractNodeId(input.getNode()), input.getBatchAddGroups().size());
         final ArrayList<ListenableFuture<RpcResult<AddGroupOutput>>> resultsLot = new ArrayList<>();
-        for (BatchAddGroups addGroup : input.getBatchAddGroups()) {
+        for (BatchAddGroups addGroup : input.nonnullBatchAddGroups().values()) {
             final AddGroupInput addGroupInput = new AddGroupInputBuilder(addGroup)
                     .setGroupRef(createGroupRef(input.getNode(), addGroup)).setNode(input.getNode()).build();
             resultsLot.add(salGroupService.addGroup(addGroupInput));
@@ -114,7 +114,7 @@ public class SalGroupsBatchServiceImpl implements SalGroupsBatchService {
 
         final ListenableFuture<RpcResult<List<BatchFailedGroupsOutput>>> commonResult = Futures
                 .transform(Futures.allAsList(resultsLot),
-                           GroupUtil.createCumulatingFunction(input.getBatchAddGroups()),
+                           GroupUtil.createCumulatingFunction(input.nonnullBatchAddGroups().values()),
                            MoreExecutors.directExecutor());
 
         ListenableFuture<RpcResult<AddGroupsBatchOutput>> addGroupsBulkFuture = Futures
@@ -133,7 +133,7 @@ public class SalGroupsBatchServiceImpl implements SalGroupsBatchService {
         LOG.trace("Removing groups @ {} : {}", PathUtil.extractNodeId(input.getNode()),
                   input.getBatchRemoveGroups().size());
         final ArrayList<ListenableFuture<RpcResult<RemoveGroupOutput>>> resultsLot = new ArrayList<>();
-        for (BatchRemoveGroups addGroup : input.getBatchRemoveGroups()) {
+        for (BatchRemoveGroups addGroup : input.nonnullBatchRemoveGroups().values()) {
             final RemoveGroupInput removeGroupInput = new RemoveGroupInputBuilder(addGroup)
                     .setGroupRef(createGroupRef(input.getNode(), addGroup)).setNode(input.getNode()).build();
             resultsLot.add(salGroupService.removeGroup(removeGroupInput));
@@ -141,7 +141,7 @@ public class SalGroupsBatchServiceImpl implements SalGroupsBatchService {
 
         final ListenableFuture<RpcResult<List<BatchFailedGroupsOutput>>> commonResult = Futures
                 .transform(Futures.allAsList(resultsLot),
-                           GroupUtil.createCumulatingFunction(input.getBatchRemoveGroups()),
+                           GroupUtil.createCumulatingFunction(input.nonnullBatchRemoveGroups().values()),
                            MoreExecutors.directExecutor());
 
         ListenableFuture<RpcResult<RemoveGroupsBatchOutput>> removeGroupsBulkFuture = Futures
index 90e83399badc7cb4430f6234a486035e2aacd227..174cb4db7739d845fe2b0dab5f88c225faec4130 100644 (file)
@@ -108,7 +108,7 @@ public class SalMetersBatchServiceImpl implements SalMetersBatchService {
     public ListenableFuture<RpcResult<AddMetersBatchOutput>> addMetersBatch(final AddMetersBatchInput input) {
         LOG.trace("Adding meters @ {} : {}", PathUtil.extractNodeId(input.getNode()), input.getBatchAddMeters().size());
         final ArrayList<ListenableFuture<RpcResult<AddMeterOutput>>> resultsLot = new ArrayList<>();
-        for (BatchAddMeters addMeter : input.getBatchAddMeters()) {
+        for (BatchAddMeters addMeter : input.nonnullBatchAddMeters().values()) {
             final AddMeterInput addMeterInput = new AddMeterInputBuilder(addMeter)
                     .setMeterRef(createMeterRef(input.getNode(), addMeter))
                     .setNode(input.getNode())
@@ -118,7 +118,7 @@ public class SalMetersBatchServiceImpl implements SalMetersBatchService {
 
         final ListenableFuture<RpcResult<List<BatchFailedMetersOutput>>> commonResult =
                 Futures.transform(Futures.allAsList(resultsLot),
-                        MeterUtil.createCumulativeFunction(input.getBatchAddMeters()),
+                        MeterUtil.createCumulativeFunction(input.nonnullBatchAddMeters().values()),
                         MoreExecutors.directExecutor());
 
         ListenableFuture<RpcResult<AddMetersBatchOutput>> addMetersBulkFuture =
@@ -138,7 +138,7 @@ public class SalMetersBatchServiceImpl implements SalMetersBatchService {
                   PathUtil.extractNodeId(input.getNode()),
                   input.getBatchRemoveMeters().size());
         final ArrayList<ListenableFuture<RpcResult<RemoveMeterOutput>>> resultsLot = new ArrayList<>();
-        for (BatchRemoveMeters addMeter : input.getBatchRemoveMeters()) {
+        for (BatchRemoveMeters addMeter : input.nonnullBatchRemoveMeters().values()) {
             final RemoveMeterInput removeMeterInput = new RemoveMeterInputBuilder(addMeter)
                     .setMeterRef(createMeterRef(input.getNode(), addMeter))
                     .setNode(input.getNode())
@@ -148,7 +148,7 @@ public class SalMetersBatchServiceImpl implements SalMetersBatchService {
 
         final ListenableFuture<RpcResult<List<BatchFailedMetersOutput>>> commonResult =
                 Futures.transform(Futures.allAsList(resultsLot),
-                        MeterUtil.createCumulativeFunction(input.getBatchRemoveMeters()),
+                        MeterUtil.createCumulativeFunction(input.nonnullBatchRemoveMeters().values()),
                         MoreExecutors.directExecutor());
 
         ListenableFuture<RpcResult<RemoveMetersBatchOutput>> removeMetersBulkFuture =
index 1f6a6e2ac9241343779967d11eae22d72da7eb58..975389fdf4554bf20d047137d674cf96609f8b89 100644 (file)
@@ -61,6 +61,6 @@ public final class SalPortServiceImpl
     }
 
     private Port getPortFromInput(final UpdatePortInput input) {
-        return input.getUpdatedPort().getPort().getPort().get(0);
+        return input.getUpdatedPort().getPort().nonnullPort().values().iterator().next();
     }
 }
index fe4fbb99fd609a0ba485bc2d9072a55d596797e8..32df00eb9a5640f23f15c12c9af9f82e28f371b9 100644 (file)
@@ -86,7 +86,7 @@ public class SingleLayerTableMultipartService extends AbstractTableMultipartServ
                                 .map(MultipartReply::getMultipartReplyBody)
                                 .filter(MultipartReplyTableFeatures.class::isInstance)
                                 .flatMap(multipartReplyBody -> ((MultipartReplyTableFeatures) multipartReplyBody)
-                                    .getTableFeatures()
+                                    .nonnullTableFeatures().values()
                                     .stream())
                                 .collect(Collectors.toList()));
                         } catch (Exception e) {
index 5296890d2caacca8d7f375bb37b7246ced506cfd..5d62f7209efc3354bf4e333a5c819b42da4896a0 100755 (executable)
@@ -184,7 +184,7 @@ public final class StatisticsGatheringUtils {
                     // we have to read actual tables with all information before we set empty Flow list,
                     // merge is expensive and not applicable for lists
                     if (flowCapNodeOpt != null && flowCapNodeOpt.isPresent()) {
-                        for (final Table tableData : flowCapNodeOpt.get().getTable()) {
+                        for (final Table tableData : flowCapNodeOpt.get().nonnullTable().values()) {
                             final Table table = new TableBuilder(tableData).setFlow(Collections.emptyList()).build();
                             final InstanceIdentifier<Table> iiToTable = instanceIdentifier
                                 .child(Table.class, tableData.key());
index f14fc41f48f2f1e386f6f6b6d6aedb4f809215ee..9e7cd4383ab8cb5376f69037d935d738af5d0615 100644 (file)
@@ -16,7 +16,6 @@ import java.util.Map.Entry;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicLongFieldUpdater;
-import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -56,7 +55,7 @@ public class MessageIntelligenceAgencyImpl implements MessageIntelligenceAgency,
             new ConcurrentHashMap<>();
 
     @Override
-    public void spyMessage(@NonNull final Class<?> message, final StatisticsGroup statGroup) {
+    public void spyMessage(final Class<?> message, final StatisticsGroup statGroup) {
         Preconditions.checkNotNull(message, "Message can't be null.");
         getCounters(message, statGroup).increment();
     }
index 8cc7ceeb489dbafc8c881e6f71cef205e474cd44..c3ef683e870b6ba8aa213b487a285a01dce8ee7a 100644 (file)
@@ -7,10 +7,14 @@
  */
 package org.opendaylight.openflowplugin.impl.statistics.services;
 
+import com.google.common.collect.Lists;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Optional;
+import java.util.Set;
 import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
 import org.opendaylight.openflowjava.protocol.api.util.BinContent;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
@@ -97,7 +101,15 @@ final class AllMeterConfigStatsService
             final Optional<List<MeterConfigStats>> meterConfigStatsList =
                     convertorExecutor.convert(replyBody.getMeterConfig(), data);
 
-            meterConfigStatsList.ifPresent(meterConfigStats -> message.getMeterConfigStats().addAll(meterConfigStats));
+            meterConfigStatsList.ifPresent(meterConfigStats -> {
+                if (message.getMeterConfigStats() == null) {
+                    message.setMeterConfigStats(Lists.newArrayList(meterConfigStats));
+                } else {
+                    Set<MeterConfigStats> stats = new HashSet<>(message.getMeterConfigStats().values());
+                    stats.addAll(meterConfigStats);
+                    message.setMeterConfigStats(stats.stream().collect(Collectors.toList()));
+                }
+            });
         }
 
         return message.build();
index bd95ee2ddbe37e808e1ddfdc5f302a1f9e589faa..47b0dc5510ab9a0f01eddfadc94d2326a0f21213 100644 (file)
@@ -7,10 +7,14 @@
  */
 package org.opendaylight.openflowplugin.impl.statistics.services;
 
+import com.google.common.collect.Lists;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Optional;
+import java.util.Set;
 import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
@@ -79,7 +83,18 @@ final class GroupDescriptionService
             final Optional<List<GroupDescStats>> groupDescStatsList = convertorExecutor.convert(
                     replyBody.getGroupDesc(), data);
 
-            groupDescStatsList.ifPresent(groupDescStats -> notification.getGroupDescStats().addAll(groupDescStats));
+            groupDescStatsList.ifPresent(groupDescStats -> {
+                if (notification.getGroupDescStats() == null) {
+                    List<GroupDescStats> stats = Lists.newArrayList(groupDescStats);
+                    notification.setGroupDescStats(stats);
+                } else {
+                    Set<GroupDescStats> stats = new HashSet<>(notification.getGroupDescStats().values());
+                    stats.addAll(groupDescStats);
+                    notification.setGroupDescStats(stats.stream().collect(Collectors.toList()));
+                }
+            });
+
+
         }
 
         return notification.build();
index ed4c31cced8aa0764fcacc76291dd59e1829d41a..147c738b27de37dbfc3333e75fa97d966bbabd7f 100644 (file)
@@ -8,9 +8,13 @@
 
 package org.opendaylight.openflowplugin.impl.statistics.services.compatibility;
 
+import com.google.common.collect.Lists;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
@@ -58,7 +62,16 @@ public final class GroupStatisticsToNotificationTransformer {
             final Optional<List<GroupStats>> groupStatsList = convertorExecutor.convert(
                     replyBody.getGroupStats(), data);
 
-            groupStatsList.ifPresent(groupStats -> notification.getGroupStats().addAll(groupStats));
+            groupStatsList.ifPresent(groupStats -> {
+                if (notification.getGroupStats() == null) {
+                    List<GroupStats> stats = Lists.newArrayList(groupStats);
+                    notification.setGroupStats(stats);
+                } else {
+                    Set<GroupStats> stats = new HashSet<>(notification.getGroupStats().values());
+                    stats.addAll(groupStats);
+                    notification.setGroupStats(stats.stream().collect(Collectors.toList()));
+                }
+            });
         }
         return notification.build();
     }
index 3b40c01316625c1fe8bbda02d434933ef0042dfe..de3788bb936657665ec95950f8dab38a2d9afb3e 100644 (file)
@@ -8,9 +8,13 @@
 
 package org.opendaylight.openflowplugin.impl.statistics.services.compatibility;
 
+import com.google.common.collect.Lists;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
@@ -61,7 +65,15 @@ public final class MeterStatisticsToNotificationTransformer {
             final Optional<List<MeterStats>> meterStatsList =
                     convertorExecutor.convert(replyBody.getMeterStats(), data);
 
-            meterStatsList.ifPresent(meterStats -> notification.getMeterStats().addAll(meterStats));
+            meterStatsList.ifPresent(meterStats -> {
+                if (notification.getMeterStats() == null) {
+                    notification.setMeterStats(Lists.newArrayList(meterStats));
+                } else {
+                    Set<MeterStats> stats = new HashSet<>(notification.getMeterStats().values());
+                    stats.addAll(meterStats);
+                    notification.setMeterStats(stats.stream().collect(Collectors.toList()));
+                }
+            });
         }
 
         return notification.build();
index a4a8605580120917fda576887b0b5f18583c414e..f1adb5798de7cb5ce39bf53a755f7a02ee6b7fa7 100644 (file)
@@ -9,8 +9,12 @@
 package org.opendaylight.openflowplugin.impl.statistics.services.compatibility;
 
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.Lists;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
@@ -25,6 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.multipart.reply.port.stats.PortStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapKey;
 
@@ -65,7 +70,15 @@ public final class NodeConnectorStatisticsToNotificationTransformer {
             for (PortStats portStats : replyBody.getPortStats()) {
                 NodeConnectorStatisticsAndPortNumberMapBuilder statsBuilder =
                         processSingleNodeConnectorStats(deviceInfo, ofVersion, portStats);
-                notification.getNodeConnectorStatisticsAndPortNumberMap().add(statsBuilder.build());
+                if (notification.getNodeConnectorStatisticsAndPortNumberMap() != null) {
+                    Set<NodeConnectorStatisticsAndPortNumberMap> stats
+                            = new HashSet<>(notification.getNodeConnectorStatisticsAndPortNumberMap().values());
+                    stats.add(statsBuilder.build());
+                    notification.setNodeConnectorStatisticsAndPortNumberMap(
+                            stats.stream().collect(Collectors.toList()));
+                } else {
+                    notification.setNodeConnectorStatisticsAndPortNumberMap(Lists.newArrayList(statsBuilder.build()));
+                }
             }
         }
         return notification.build();
index 160e9d345beddfda94d36264c9a021a64d74bd6e..4e118f93b2a3a48f28def842db6c31227cfb870b 100644 (file)
@@ -8,8 +8,12 @@
 
 package org.opendaylight.openflowplugin.impl.statistics.services.compatibility;
 
+import com.google.common.collect.Lists;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
@@ -24,6 +28,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.QueueStatisticsUpdate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.QueueStatisticsUpdateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMap;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapBuilder;
 
 /**
@@ -79,7 +84,14 @@ public final class QueueStatisticsToNotificationTransformer {
 
                 statsBuilder.setQueueId(new QueueId(queueStats.getQueueId()));
 
-                notification.getQueueIdAndStatisticsMap().add(statsBuilder.build());
+                if (notification.getQueueIdAndStatisticsMap() == null) {
+                    notification.setQueueIdAndStatisticsMap(Lists.newArrayList(statsBuilder.build()));
+                } else {
+                    Set<QueueIdAndStatisticsMap> stats
+                            = new HashSet<>(notification.getQueueIdAndStatisticsMap().values());
+                    stats.add(statsBuilder.build());
+                    notification.setQueueIdAndStatisticsMap(stats.stream().collect(Collectors.toList()));
+                }
             }
         }
         return notification.build();
index 1a0303317d3dd3454277ef761790321c776399ac..27271d44297549529ddb814c4ae7a5794c562ab3 100644 (file)
@@ -44,7 +44,7 @@ public class FlowDirectStatisticsService extends AbstractFlowDirectStatisticsSer
             .setFlowAndStatisticsMapList(input
                 .stream()
                 .flatMap(multipartReply -> ((MultipartReplyFlowStats) multipartReply.getMultipartReplyBody())
-                    .getFlowAndStatisticsMapList()
+                    .nonnullFlowAndStatisticsMapList().values()
                     .stream())
                 .map(flowAndStatisticsMapList -> {
                     final FlowId flowId = new FlowId(generateFlowId(flowAndStatisticsMapList));
index 8dafbd6b8ca84253282e4bc781d3be246b37b0ef..d8be05856f96b3d62196e926a499977792fc9294 100644 (file)
@@ -40,7 +40,7 @@ public class GroupDirectStatisticsService extends AbstractGroupDirectStatisticsS
             .setGroupStats(input
                 .stream()
                 .flatMap(multipartReply -> ((MultipartReplyGroupStats) multipartReply.getMultipartReplyBody())
-                    .getGroupStats()
+                    .nonnullGroupStats().values()
                     .stream())
                 .collect(Collectors.toList()))
             .build();
index c0193904cd0d910eac9f2f0d050898323615303e..d12461f374c087acb46ad621e19c101e1c18d7af 100644 (file)
@@ -40,7 +40,7 @@ public class MeterDirectStatisticsService extends AbstractMeterDirectStatisticsS
             .setMeterStats(input
                 .stream()
                 .flatMap(multipartReply -> ((MultipartReplyMeterStats) multipartReply.getMultipartReplyBody())
-                    .getMeterStats()
+                    .nonnullMeterStats().values()
                     .stream())
                 .collect(Collectors.toList()))
             .build();
index 52b2bc7522e7911c31442703c4363f6f8ccc71dc..6f12bcc6038c40f7534b73180e2437ed9f8738fe 100644 (file)
@@ -40,8 +40,8 @@ public class PortDirectStatisticsService extends AbstractPortDirectStatisticsSer
             .setNodeConnectorStatisticsAndPortNumberMap(input
                 .stream()
                 .flatMap(multipartReply -> ((MultipartReplyPortStats) multipartReply.getMultipartReplyBody())
-                    .getNodeConnectorStatisticsAndPortNumberMap()
-                    .stream())
+                    .nonnullNodeConnectorStatisticsAndPortNumberMap()
+                    .values().stream())
                 .collect(Collectors.toList()))
             .build();
     }
index a3e09bebee025248e8c065a2be427aecff9aea56..e8e118723d659ff7db1be3af02123e840a0437c6 100644 (file)
@@ -40,7 +40,7 @@ public class QueueDirectStatisticsService extends AbstractQueueDirectStatisticsS
             .setQueueIdAndStatisticsMap(input
                 .stream()
                 .flatMap(multipartReply -> ((MultipartReplyQueueStats) multipartReply.getMultipartReplyBody())
-                    .getQueueIdAndStatisticsMap()
+                    .nonnullQueueIdAndStatisticsMap().values()
                     .stream())
                 .collect(Collectors.toList()))
             .build();
index 6d32df52a37a0c6c7be9ab39dd52a117facc8216..9fee75d23e8aef990634f4da049c2d41310b0d91 100644 (file)
@@ -88,9 +88,8 @@ public class PacketReceivedTranslator implements MessageTranslator<PacketInMessa
                 .orElseGet(MatchBuilder::new);
 
         final AugmentTuple<org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match>
-                matchExtensionWrap = MatchExtensionHelper
-                .processAllExtensions(input.getMatch().getMatchEntry(), OpenflowVersion.get(input.getVersion()),
-                                      MatchPath.PACKET_RECEIVED_MATCH);
+                matchExtensionWrap = MatchExtensionHelper.processAllExtensions(input.getMatch().nonnullMatchEntry(),
+                    OpenflowVersion.get(input.getVersion()), MatchPath.PACKET_RECEIVED_MATCH);
 
         if (matchExtensionWrap != null) {
             matchBuilder.addAugmentation(matchExtensionWrap.getAugmentationClass(),
index 15681a1a6f9dc7bfdf3c3e5dd8551ebe8d9d5532..70a1c95546e88ddb20811d7e18cbbc21fd84aa0c 100644 (file)
@@ -47,8 +47,7 @@ public final class AddressNormalizationUtil {
      * @param protocolVersion the OpenFLow protocol version
      * @return normalized uri
      */
-    @Nullable
-    public static Uri normalizeProtocolAgnosticPort(@Nullable final Uri port, final short protocolVersion) {
+    public static @Nullable Uri normalizeProtocolAgnosticPort(@Nullable final Uri port, final short protocolVersion) {
         if (port == null) {
             return null;
         }
@@ -65,8 +64,7 @@ public final class AddressNormalizationUtil {
      * @param ipv6Prefix the Ipv6 prefix
      * @return normalized Ipv6 prefix
      */
-    @Nullable
-    public static Ipv6Prefix normalizeIpv6Prefix(@Nullable final Ipv6Prefix ipv6Prefix) {
+    public static @Nullable Ipv6Prefix normalizeIpv6Prefix(@Nullable final Ipv6Prefix ipv6Prefix) {
         if (ipv6Prefix == null) {
             return null;
         }
@@ -84,9 +82,8 @@ public final class AddressNormalizationUtil {
      * @param ipv4Mask    the Ipv4 mask
      * @return normalized Ipv6 prefix
      */
-    @Nullable
-    public static Ipv6Prefix normalizeIpv6Arbitrary(@Nullable final Ipv6Address ipv6Address,
-                                                    @Nullable final Ipv6ArbitraryMask ipv4Mask) {
+    public static @Nullable Ipv6Prefix normalizeIpv6Arbitrary(@Nullable final Ipv6Address ipv6Address,
+                                                              @Nullable final Ipv6ArbitraryMask ipv4Mask) {
         if (ipv6Address == null) {
             return null;
         }
@@ -102,8 +99,7 @@ public final class AddressNormalizationUtil {
      * @param ipv6Address the Ipv6 address
      * @return normalized Ipv6 address
      */
-    @Nullable
-    public static Ipv6Address normalizeIpv6AddressWithoutMask(@Nullable final Ipv6Address ipv6Address) {
+    public static @Nullable Ipv6Address normalizeIpv6AddressWithoutMask(@Nullable final Ipv6Address ipv6Address) {
         final Ipv6Prefix ipv6Prefix = normalizeIpv6Arbitrary(ipv6Address, null);
         return ipv6Prefix == null ? null : new Ipv6Address(ipv6Prefix.getValue().split(PREFIX_SEPARATOR)[0]);
     }
@@ -114,8 +110,7 @@ public final class AddressNormalizationUtil {
      * @param ipv4Prefix the Ipv4 prefix
      * @return normalized Ipv4 prefix
      */
-    @Nullable
-    public static Ipv4Prefix normalizeIpv4Prefix(@Nullable final Ipv4Prefix ipv4Prefix) {
+    public static @Nullable Ipv4Prefix normalizeIpv4Prefix(@Nullable final Ipv4Prefix ipv4Prefix) {
         if (ipv4Prefix == null) {
             return null;
         }
@@ -133,9 +128,8 @@ public final class AddressNormalizationUtil {
      * @param ipv4Mask    the Ipv4 mask
      * @return normalized Ipv4 prefix
      */
-    @Nullable
-    public static Ipv4Prefix normalizeIpv4Arbitrary(@Nullable final Ipv4Address ipv4Address,
-                                                    @Nullable final DottedQuad ipv4Mask) {
+    public static @Nullable Ipv4Prefix normalizeIpv4Arbitrary(@Nullable final Ipv4Address ipv4Address,
+                                                              @Nullable final DottedQuad ipv4Mask) {
         if (ipv4Address == null) {
             return null;
         }
@@ -152,8 +146,8 @@ public final class AddressNormalizationUtil {
      * @param mask    Ipv4 mask byte array
      * @return normalized Ipv4 prefix
      */
-    @Nullable
-    public static Ipv4Prefix normalizeIpv4Address(@Nullable final byte[] address, @Nullable final byte[] mask) {
+    public static @Nullable Ipv4Prefix normalizeIpv4Address(final byte @Nullable [] address,
+                                                            final byte @Nullable [] mask) {
         final String addressPrefix = normalizeInetAddressWithMask(normalizeIpAddress(address, mask), mask);
 
         if (addressPrefix == null) {
@@ -171,8 +165,8 @@ public final class AddressNormalizationUtil {
      * @param mask    Ipv6 mask byte array
      * @return normalized Ipv6 prefix
      */
-    @Nullable
-    public static Ipv6Prefix normalizeIpv6Address(@Nullable final byte[] address, @Nullable final byte[] mask) {
+    public static @Nullable Ipv6Prefix normalizeIpv6Address(final byte @Nullable [] address,
+                                                            final byte @Nullable [] mask) {
         final String addressPrefix = normalizeInetAddressWithMask(normalizeIpAddress(address, mask), mask);
 
         if (addressPrefix == null) {
@@ -189,8 +183,8 @@ public final class AddressNormalizationUtil {
      * @param mask    mask byte array
      * @return normalized Inet address
      */
-    @Nullable
-    public static InetAddress normalizeIpAddress(@Nullable final byte[] address, @Nullable final byte[] mask) {
+    public static @Nullable InetAddress normalizeIpAddress(final byte @Nullable [] address,
+                                                           final byte @Nullable [] mask) {
         if (address == null) {
             return null;
         }
@@ -216,9 +210,8 @@ public final class AddressNormalizationUtil {
      * @param mask    the mask
      * @return the string
      */
-    @Nullable
-    public static String normalizeInetAddressWithMask(@Nullable final InetAddress address,
-                                                      @Nullable final byte[] mask) {
+    public static @Nullable String normalizeInetAddressWithMask(final @Nullable InetAddress address,
+                                                                final byte @Nullable [] mask) {
         if (address == null) {
             return null;
         }
index 03071d2e79864a084e71a4fa45ff070f524e64c9..292af59b732a4ada82d12f03405d240a003d67d9 100644 (file)
@@ -14,6 +14,7 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.EnumSet;
 import java.util.List;
 import org.opendaylight.openflowplugin.impl.services.batch.BatchPlanStep;
@@ -77,14 +78,14 @@ public final class FlatBatchUtil {
     }
 
     private static boolean isGroupBarrierNeeded(final EnumSet<BatchStepType> previousTypes, final BatchStepType type) {
-        return (type == BatchStepType.GROUP_ADD
+        return type == BatchStepType.GROUP_ADD
                 && (previousTypes.contains(BatchStepType.GROUP_ADD)
-                || previousTypes.contains(BatchStepType.GROUP_UPDATE)))
-                || (type == BatchStepType.GROUP_REMOVE
+                || previousTypes.contains(BatchStepType.GROUP_UPDATE))
+                || type == BatchStepType.GROUP_REMOVE
                 && (previousTypes.contains(BatchStepType.FLOW_REMOVE)
                 || previousTypes.contains(BatchStepType.FLOW_UPDATE)
                 || previousTypes.contains(BatchStepType.GROUP_REMOVE)
-                || previousTypes.contains(BatchStepType.GROUP_UPDATE)));
+                || previousTypes.contains(BatchStepType.GROUP_UPDATE));
     }
 
     private static boolean isMeterBarrierNeeded(final EnumSet<BatchStepType> previousTypes, final BatchStepType type) {
@@ -93,7 +94,7 @@ public final class FlatBatchUtil {
                 || previousTypes.contains(BatchStepType.FLOW_UPDATE));
     }
 
-    public static List<BatchPlanStep> assembleBatchPlan(List<Batch> batches) {
+    public static List<BatchPlanStep> assembleBatchPlan(final Collection<Batch> batches) {
         final List<BatchPlanStep> plan = new ArrayList<>();
 
         BatchPlanStep planStep;
@@ -110,36 +111,36 @@ public final class FlatBatchUtil {
         return plan;
     }
 
-    private static List<? extends BatchOrderGrouping> extractBatchData(final BatchStepType batchStepType,
+    private static Collection<? extends BatchOrderGrouping> extractBatchData(final BatchStepType batchStepType,
                                                                        final BatchChoice batchChoice) {
-        final List<? extends BatchOrderGrouping> batchData;
+        final Collection<? extends BatchOrderGrouping> batchData;
         switch (batchStepType) {
             case FLOW_ADD:
-                batchData = ((FlatBatchAddFlowCase) batchChoice).getFlatBatchAddFlow();
+                batchData = ((FlatBatchAddFlowCase) batchChoice).nonnullFlatBatchAddFlow().values();
                 break;
             case FLOW_REMOVE:
-                batchData = ((FlatBatchRemoveFlowCase) batchChoice).getFlatBatchRemoveFlow();
+                batchData = ((FlatBatchRemoveFlowCase) batchChoice).nonnullFlatBatchRemoveFlow().values();
                 break;
             case FLOW_UPDATE:
-                batchData = ((FlatBatchUpdateFlowCase) batchChoice).getFlatBatchUpdateFlow();
+                batchData = ((FlatBatchUpdateFlowCase) batchChoice).nonnullFlatBatchUpdateFlow().values();
                 break;
             case GROUP_ADD:
-                batchData = ((FlatBatchAddGroupCase) batchChoice).getFlatBatchAddGroup();
+                batchData = ((FlatBatchAddGroupCase) batchChoice).nonnullFlatBatchAddGroup().values();
                 break;
             case GROUP_REMOVE:
-                batchData = ((FlatBatchRemoveGroupCase) batchChoice).getFlatBatchRemoveGroup();
+                batchData = ((FlatBatchRemoveGroupCase) batchChoice).nonnullFlatBatchRemoveGroup().values();
                 break;
             case GROUP_UPDATE:
-                batchData = ((FlatBatchUpdateGroupCase) batchChoice).getFlatBatchUpdateGroup();
+                batchData = ((FlatBatchUpdateGroupCase) batchChoice).nonnullFlatBatchUpdateGroup().values();
                 break;
             case METER_ADD:
-                batchData = ((FlatBatchAddMeterCase) batchChoice).getFlatBatchAddMeter();
+                batchData = ((FlatBatchAddMeterCase) batchChoice).nonnullFlatBatchAddMeter().values();
                 break;
             case METER_REMOVE:
-                batchData = ((FlatBatchRemoveMeterCase) batchChoice).getFlatBatchRemoveMeter();
+                batchData = ((FlatBatchRemoveMeterCase) batchChoice).nonnullFlatBatchRemoveMeter().values();
                 break;
             case METER_UPDATE:
-                batchData = ((FlatBatchUpdateMeterCase) batchChoice).getFlatBatchUpdateMeter();
+                batchData = ((FlatBatchUpdateMeterCase) batchChoice).nonnullFlatBatchUpdateMeter().values();
                 break;
             default:
                 throw new IllegalArgumentException("Unsupported batch step type obtained: " + batchStepType);
@@ -186,9 +187,9 @@ public final class FlatBatchUtil {
 
             for (RpcResult<ProcessFlatBatchOutput> jobResult : jobsResults) {
                 if (jobResult != null) {
-                    isSuccessful = (isSuccessful && jobResult.isSuccessful());
+                    isSuccessful = isSuccessful && jobResult.isSuccessful();
                     rpcErrors.addAll(jobResult.getErrors());
-                    batchFailures.addAll(jobResult.getResult().getBatchFailure());
+                    batchFailures.addAll(jobResult.getResult().nonnullBatchFailure().values());
                 }
             }
 
index 44719b77b19c4ee8411edd4c02022d873fa324f9..34ed1e2bd666e30b93549328230e6e5c6d799587 100644 (file)
@@ -17,7 +17,6 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import org.apache.commons.lang3.tuple.Pair;
-import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
@@ -196,19 +195,19 @@ public final class FlowUtil {
      * @return static reusable function
      */
     public static <O> Function<List<RpcResult<O>>, RpcResult<List<BatchFailedFlowsOutput>>> createCumulatingFunction(
-            final List<? extends BatchFlowIdGrouping> inputBatchFlows) {
+            final Collection<? extends BatchFlowIdGrouping> inputBatchFlows) {
         return new CumulatingFunction<O>(inputBatchFlows).invoke();
     }
 
     private static class CumulatingFunction<O> {
-        private final List<? extends BatchFlowIdGrouping> inputBatchFlows;
+        private final Collection<? extends BatchFlowIdGrouping> inputBatchFlows;
 
-        CumulatingFunction(final List<? extends BatchFlowIdGrouping> inputBatchFlows) {
+        CumulatingFunction(final Collection<? extends BatchFlowIdGrouping> inputBatchFlows) {
             this.inputBatchFlows = inputBatchFlows;
         }
 
         public Function<List<RpcResult<O>>, RpcResult<List<BatchFailedFlowsOutput>>> invoke() {
-            return (@NonNull final List<RpcResult<O>> innerInput) -> {
+            return (final List<RpcResult<O>> innerInput) -> {
                 final int sizeOfFutures = innerInput.size();
                 final int sizeOfInputBatch = inputBatchFlows.size();
                 Preconditions.checkArgument(sizeOfFutures == sizeOfInputBatch,
index 47500a30b5a3c14240ee71d61a7b2292ee0052e2..ce4f5b7d93c52cd07503b080a203ff3d753b58c0 100644 (file)
@@ -12,6 +12,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.function.Function;
+import java.util.stream.Collectors;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionResolvers;
@@ -159,6 +160,8 @@ public final class MatchUtil {
         return ExtensionResolvers
                 .getMatchExtensionResolver()
                 .getExtension(match)
-                .flatMap(matchExtension -> Optional.ofNullable(matchExtension.getExtensionList()));
+                .flatMap(matchExtension ->
+                        Optional.ofNullable(matchExtension.nonnullExtensionList().values()
+                        .stream().collect(Collectors.toList())));
     }
 }
index 8f1d6e173a8ccfab733e4bc455455e2c301b7b6e..5610f5e2a02468c6df8e4065af6dac5c35743e43 100644 (file)
@@ -84,7 +84,7 @@ public class TransactionChainManagerTest {
         txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
 
         Mockito.verify(txChain).newReadWriteTransaction();
-        Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data, false);
+        Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data);
     }
 
     /**
@@ -98,7 +98,7 @@ public class TransactionChainManagerTest {
         txChainManager.submitTransaction();
 
         Mockito.verify(txChain).newReadWriteTransaction();
-        Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data, false);
+        Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data);
         Mockito.verify(writeTx).commit();
     }
 
@@ -112,7 +112,7 @@ public class TransactionChainManagerTest {
         txChainManager.submitTransaction();
 
         Mockito.verify(txChain).newReadWriteTransaction();
-        Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data, false);
+        Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data);
         Mockito.verify(writeTx, Mockito.never()).commit();
     }
 
@@ -126,7 +126,7 @@ public class TransactionChainManagerTest {
         txChainManager.submitTransaction();
 
         Mockito.verify(txChain).newReadWriteTransaction();
-        Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data, false);
+        Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data);
         Mockito.verify(writeTx).commit();
     }
 
@@ -140,7 +140,7 @@ public class TransactionChainManagerTest {
         txChainManager.writeToTransaction(LogicalDatastoreType.CONFIGURATION, path, data, false);
 
         Mockito.verify(txChain).newReadWriteTransaction();
-        Mockito.verify(writeTx, Mockito.times(2)).put(LogicalDatastoreType.CONFIGURATION, path, data, false);
+        Mockito.verify(writeTx, Mockito.times(2)).put(LogicalDatastoreType.CONFIGURATION, path, data);
         Mockito.verify(writeTx, Mockito.never()).commit();
     }
 
@@ -182,7 +182,7 @@ public class TransactionChainManagerTest {
         txChainManager.deactivateTransactionManager();
 
         Mockito.verify(txChain).newReadWriteTransaction();
-        Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data, false);
+        Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data);
         Mockito.verify(writeTx, Mockito.never()).commit();
         Mockito.verify(writeTx).cancel();
         Mockito.verify(txChain).close();
@@ -196,7 +196,7 @@ public class TransactionChainManagerTest {
         txChainManager.shuttingDown();
 
         Mockito.verify(txChain).newReadWriteTransaction();
-        Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data, false);
+        Mockito.verify(writeTx).put(LogicalDatastoreType.CONFIGURATION, path, data);
         Mockito.verify(writeTx).commit();
     }
 
index c13c4d2ceabd476ffbc1fd71efd60ece34571ddf..ad567f32201f04a67ebd449d98c640766508cd21 100644 (file)
@@ -58,7 +58,7 @@ public class ApplyActionsInstructionDeserializerTest extends AbstractInstruction
         assertEquals(ApplyActionsCase.class, instruction.implementedInterface());
         final ApplyActionsCase actionCase = (ApplyActionsCase) instruction;
         assertEquals(1, actionCase.getApplyActions().getAction().size());
-        assertEquals(PopPbbActionCase.class, actionCase.getApplyActions().getAction().get(0)
+        assertEquals(PopPbbActionCase.class, actionCase.getApplyActions().nonnullAction().values().iterator().next()
                 .getAction().implementedInterface());
         assertEquals(0, in.readableBytes());
     }
index 35e32747baebc2f391197f57d4abd844194e4ba4..be39ff50bafa2fc46469748ed1b04800c55d3012 100644 (file)
@@ -58,7 +58,7 @@ public class WriteActionsInstructionDeserializerTest extends AbstractInstruction
         assertEquals(WriteActionsCase.class, instruction.implementedInterface());
         final WriteActionsCase actionCase = (WriteActionsCase) instruction;
         assertEquals(1, actionCase.getWriteActions().getAction().size());
-        assertEquals(PopPbbActionCase.class, actionCase.getWriteActions().getAction().get(0)
+        assertEquals(PopPbbActionCase.class, actionCase.getWriteActions().nonnullAction().values().iterator().next()
                 .getAction().implementedInterface());
         assertEquals(0, in.readableBytes());
     }
index 5d61becb2ff5ff52a44244aed26d613b6aa655ac..8457bc7ed66718ca07924a12e25e141cff1af1eb 100644 (file)
@@ -129,12 +129,13 @@ public class FlowMessageDeserializerTest extends AbstractDeserializerTest {
         assertEquals(MPLS_LABEL, message.getMatch().getProtocolMatchFields().getMplsLabel().intValue());
         assertEquals(1, message.getInstructions().getInstruction().size());
 
-        final Instruction instruction = message.getInstructions().getInstruction().get(0).getInstruction();
+        final Instruction instruction = message.getInstructions().nonnullInstruction().values().iterator().next()
+                .getInstruction();
         assertEquals(ApplyActionsCase.class, instruction.implementedInterface());
 
         final ApplyActionsCase applyActions = (ApplyActionsCase) instruction;
         assertEquals(1, applyActions.getApplyActions().getAction().size());
-        assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().getAction().get(0)
+        assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().nonnullAction().values().iterator().next()
                 .getAction().implementedInterface());
     }
 
index 949294cdd1633d126deb2f92965d6efcf369204c..81f52b80ede7fd0594fe69f1b7a986d0be5094a9 100644 (file)
@@ -5,7 +5,6 @@
  * 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.openflowplugin.impl.protocol.deserialization.messages;
 
 import static org.junit.Assert.assertEquals;
@@ -79,12 +78,13 @@ public class GroupMessageDeserializerTest extends AbstractDeserializerTest {
         assertEquals(GROUP_TYPE.getIntValue(), message.getGroupType().getIntValue());
         assertEquals(1, message.getBuckets().getBucket().size());
 
-        final Bucket bucket = message.getBuckets().getBucket().get(0);
+        final Bucket bucket = message.getBuckets().nonnullBucket().values().iterator().next();
         assertEquals(WEIGHT, bucket.getWeight().shortValue());
         assertEquals(WATCH_PORT, bucket.getWatchPort().intValue());
         assertEquals(WATCH_GROUP, bucket.getWatchGroup().intValue());
         assertEquals(1, bucket.getAction().size());
-        assertEquals(PopPbbActionCase.class, bucket.getAction().get(0).getAction().implementedInterface());
+        assertEquals(PopPbbActionCase.class,
+            bucket.nonnullAction().values().iterator().next().getAction().implementedInterface());
     }
 
 }
index 56d82f0989743f2daa72180a5dbb1f16e8dc110b..c0268b652db0b7e77d6ed178f3164a94a6cb31c5 100644 (file)
@@ -13,7 +13,8 @@ import static org.junit.Assert.assertTrue;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.UnpooledByteBufAllocator;
-import java.util.List;
+import java.util.Iterator;
+import java.util.Map;
 import org.junit.Test;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.openflowjava.util.ByteBufUtils;
@@ -22,6 +23,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.Drop;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.DscpRemark;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeader;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeaderKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterModCommand;
 
 public class MeterMessageDeserializerTest extends AbstractDeserializerTest {
@@ -85,11 +87,13 @@ public class MeterMessageDeserializerTest extends AbstractDeserializerTest {
         assertEquals(message.getFlags().isMeterStats(), IS_STATS);
         assertEquals(message.getMeterId().getValue().intValue(), ID);
 
-        final List<MeterBandHeader> meterBandHeader = message.getMeterBandHeaders().getMeterBandHeader();
+        final Map<MeterBandHeaderKey, MeterBandHeader> meterBandHeader =
+                message.getMeterBandHeaders().nonnullMeterBandHeader();
         assertEquals(meterBandHeader.size(), 2);
+        final Iterator<MeterBandHeader> meterBandHeaderIt = meterBandHeader.values().iterator();
 
         // Drop band
-        final MeterBandHeader dropHeader = meterBandHeader.get(0);
+        final MeterBandHeader dropHeader = meterBandHeaderIt.next();
         assertEquals(Drop.class, dropHeader.getBandType().implementedInterface());
         assertTrue(dropHeader.getMeterBandTypes().getFlags().isOfpmbtDrop());
 
@@ -98,7 +102,7 @@ public class MeterMessageDeserializerTest extends AbstractDeserializerTest {
         assertEquals(DROP_BURST, drop.getDropBurstSize().intValue());
 
         // Dscp band
-        final MeterBandHeader dscpHeader = meterBandHeader.get(1);
+        final MeterBandHeader dscpHeader = meterBandHeaderIt.next();
         assertEquals(DscpRemark.class, dscpHeader.getBandType().implementedInterface());
         assertTrue(dscpHeader.getMeterBandTypes().getFlags().isOfpmbtDscpRemark());
 
index 5db27f9baba6fb201c4f2316f54e13177f18c9b6..3e4dbd174c9b25d873caac32841c424c806c6754 100644 (file)
@@ -129,7 +129,8 @@ public class MultipartReplyFlowStatsDeserializerTest extends AbstractMultipartDe
         buffer.setShort(instructionLengthIndex, buffer.writerIndex() - instructionStartIndex);
 
         final MultipartReplyFlowStats reply = (MultipartReplyFlowStats) deserializeMultipart(buffer);
-        final FlowAndStatisticsMapList flowAndStatisticsMapList = reply.getFlowAndStatisticsMapList().get(0);
+        final FlowAndStatisticsMapList flowAndStatisticsMapList =
+                reply.nonnullFlowAndStatisticsMapList().values().iterator().next();
         assertEquals(TABLE_ID, flowAndStatisticsMapList.getTableId().shortValue());
         assertEquals(SECOND, flowAndStatisticsMapList.getDuration().getSecond().getValue().intValue());
         assertEquals(NANOSECOND, flowAndStatisticsMapList.getDuration().getNanosecond().getValue().intValue());
@@ -142,23 +143,22 @@ public class MultipartReplyFlowStatsDeserializerTest extends AbstractMultipartDe
         assertEquals(PACKET_COUNT, flowAndStatisticsMapList.getPacketCount().getValue().longValue());
 
         assertEquals(2, flowAndStatisticsMapList.getInstructions().getInstruction().size());
+        final var instructionIter = flowAndStatisticsMapList.getInstructions().nonnullInstruction().values().iterator();
 
-        final Instruction instruction =
-                flowAndStatisticsMapList.getInstructions().getInstruction().get(0).getInstruction();
+        final Instruction instruction = instructionIter.next().getInstruction();
         assertEquals(ApplyActionsCase.class, instruction.implementedInterface());
 
         final ApplyActionsCase applyActions = (ApplyActionsCase) instruction;
-        assertEquals(1, applyActions.getApplyActions().getAction().size());
-        assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().getAction().get(0)
+        assertEquals(1, applyActions.getApplyActions().nonnullAction().size());
+        assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().nonnullAction().values().iterator().next()
                 .getAction().implementedInterface());
 
-        final Instruction instruction1 =
-                flowAndStatisticsMapList.getInstructions().getInstruction().get(1).getInstruction();
+        final Instruction instruction1 = instructionIter.next().getInstruction();
         assertEquals(WriteActionsCase.class, instruction1.implementedInterface());
 
         final WriteActionsCase writeActions = (WriteActionsCase) instruction1;
         assertEquals(1, writeActions.getWriteActions().getAction().size());
-        assertEquals(PopVlanActionCase.class, writeActions.getWriteActions().getAction().get(0)
+        assertEquals(PopVlanActionCase.class, writeActions.getWriteActions().nonnullAction().values().iterator().next()
                 .getAction().implementedInterface());
     }
 
index f3902ce0a55421b985befbc5866434849872c72e..1f65b045f3838d4b8f57e5b2c05dbbcc43e80389 100644 (file)
@@ -12,6 +12,7 @@ import static org.junit.Assert.assertEquals;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.UnpooledByteBufAllocator;
 import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMap;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.multipart.reply.multipart.reply.body.MultipartReplyFlowTableStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 
@@ -32,12 +33,11 @@ public class MultipartReplyFlowTableStatsDeserializerTest extends AbstractMultip
         buffer.writeLong(PACKETS_MATCHED);
 
         final MultipartReplyFlowTableStats reply = (MultipartReplyFlowTableStats) deserializeMultipart(buffer);
-        assertEquals(TABLE_ID, reply.getFlowTableAndStatisticsMap().get(0).getTableId().getValue().byteValue());
-        assertEquals(ACTIVE_FLOWS, reply.getFlowTableAndStatisticsMap().get(0).getActiveFlows().getValue().intValue());
-        assertEquals(PACKETS_LOOKEDUP, reply.getFlowTableAndStatisticsMap().get(0).getPacketsLookedUp().getValue()
-                .longValue());
-        assertEquals(PACKETS_MATCHED, reply.getFlowTableAndStatisticsMap().get(0).getPacketsMatched().getValue()
-                .longValue());
+        final FlowTableAndStatisticsMap first = reply.nonnullFlowTableAndStatisticsMap().values().iterator().next();
+        assertEquals(TABLE_ID, first.getTableId().getValue().byteValue());
+        assertEquals(ACTIVE_FLOWS, first.getActiveFlows().getValue().intValue());
+        assertEquals(PACKETS_LOOKEDUP, first.getPacketsLookedUp().getValue().longValue());
+        assertEquals(PACKETS_MATCHED, first.getPacketsMatched().getValue().longValue());
         assertEquals(0, buffer.readableBytes());
     }
 
index 464583f3329ea1851a63b5be639ab2b33309db85..45a3a1fc5d9f8828af3ec194a0f629fe6758cac4 100644 (file)
@@ -16,6 +16,8 @@ import org.junit.Test;
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupDesc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 
 public class MultipartReplyGroupDescDeserializerTest extends AbstractMultipartDeserializerTest {
@@ -48,14 +50,14 @@ public class MultipartReplyGroupDescDeserializerTest extends AbstractMultipartDe
         buffer.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
 
         final MultipartReplyGroupDesc reply = (MultipartReplyGroupDesc) deserializeMultipart(buffer);
+        final GroupDescStats firstGroupDescStats = reply.nonnullGroupDescStats().values().iterator().next();
+        assertEquals(GROUP_ID, firstGroupDescStats.getGroupId().getValue().intValue());
+        assertEquals(GROUP_TYPE, firstGroupDescStats.getGroupType().getIntValue());
 
-        assertEquals(GROUP_ID, reply.getGroupDescStats().get(0).getGroupId().getValue().intValue());
-        assertEquals(WEIGHT, reply.getGroupDescStats().get(0).getBuckets().getBucket().get(0).getWeight().intValue());
-        assertEquals(WATCH_PORT, reply.getGroupDescStats().get(0).getBuckets().getBucket().get(0).getWatchPort()
-                .intValue());
-        assertEquals(WATCH_GROUP, reply.getGroupDescStats().get(0).getBuckets().getBucket().get(0).getWatchGroup()
-                .intValue());
-        assertEquals(GROUP_TYPE, reply.getGroupDescStats().get(0).getGroupType().getIntValue());
+        final Bucket firstBucket = firstGroupDescStats.getBuckets().nonnullBucket().values().iterator().next();
+        assertEquals(WEIGHT, firstBucket.getWeight().intValue());
+        assertEquals(WATCH_PORT, firstBucket.getWatchPort().intValue());
+        assertEquals(WATCH_GROUP, firstBucket.getWatchGroup().intValue());
         assertEquals(0, buffer.readableBytes());
     }
 
index f6a00986e9424f4101a19b6863f1898f877298db..30e1d4744200d31556222f44fdb999f8dc5dc43e 100644 (file)
@@ -14,6 +14,7 @@ import io.netty.buffer.ByteBuf;
 import io.netty.buffer.UnpooledByteBufAllocator;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 
 public class MultipartReplyGroupStatsDeserializerTest extends AbstractMultipartDeserializerTest {
@@ -44,14 +45,15 @@ public class MultipartReplyGroupStatsDeserializerTest extends AbstractMultipartD
         buffer.writeLong(BYTE_COUNT);
 
         final MultipartReplyGroupStats reply = (MultipartReplyGroupStats) deserializeMultipart(buffer);
-        assertEquals(GROUP_ID, reply.getGroupStats().get(0).getGroupId().getValue().intValue());
-        assertEquals(REF_COUNT, reply.getGroupStats().get(0).getRefCount().getValue().intValue());
-        assertEquals(PACKET_COUNT, reply.getGroupStats().get(0).getPacketCount().getValue().longValue());
-        assertEquals(BYTE_COUNT, reply.getGroupStats().get(0).getByteCount().getValue().longValue());
-        assertEquals(SECOND, reply.getGroupStats().get(0).getDuration().getSecond().getValue().intValue());
-        assertEquals(NANOSECOND, reply.getGroupStats().get(0).getDuration().getNanosecond().getValue().intValue());
-        assertEquals(PACKET_COUNT, reply.getGroupStats().get(0).getPacketCount().getValue().longValue());
-        assertEquals(BYTE_COUNT, reply.getGroupStats().get(0).getByteCount().getValue().longValue());
+        final GroupStats firstGroupStats = reply.nonnullGroupStats().values().iterator().next();
+        assertEquals(GROUP_ID, firstGroupStats.getGroupId().getValue().intValue());
+        assertEquals(REF_COUNT, firstGroupStats.getRefCount().getValue().intValue());
+        assertEquals(PACKET_COUNT, firstGroupStats.getPacketCount().getValue().longValue());
+        assertEquals(BYTE_COUNT, firstGroupStats.getByteCount().getValue().longValue());
+        assertEquals(SECOND, firstGroupStats.getDuration().getSecond().getValue().intValue());
+        assertEquals(NANOSECOND, firstGroupStats.getDuration().getNanosecond().getValue().intValue());
+        assertEquals(PACKET_COUNT, firstGroupStats.getPacketCount().getValue().longValue());
+        assertEquals(BYTE_COUNT, firstGroupStats.getByteCount().getValue().longValue());
         assertEquals(0, buffer.readableBytes());
     }
 
index 70d4672ff9d22063266b89b695573d240bb0d62b..eb2bc28cb4fcb7a093bafb90a3100148155e067a 100644 (file)
@@ -134,7 +134,8 @@ public class MultipartReplyMessageDeserializerTest extends AbstractDeserializerT
         final MultipartReplyFlowStats reply = (MultipartReplyFlowStats) message.getMultipartReplyBody();
 
         assertEquals(XID, message.getXid().intValue());
-        final FlowAndStatisticsMapList flowAndStatisticsMapList = reply.getFlowAndStatisticsMapList().get(0);
+        final FlowAndStatisticsMapList flowAndStatisticsMapList =
+                reply.nonnullFlowAndStatisticsMapList().values().iterator().next();
         assertEquals(TABLE_ID, flowAndStatisticsMapList.getTableId().shortValue());
         assertEquals(SECOND, flowAndStatisticsMapList.getDuration().getSecond().getValue().intValue());
         assertEquals(NANOSECOND, flowAndStatisticsMapList.getDuration().getNanosecond().getValue().intValue());
@@ -149,12 +150,13 @@ public class MultipartReplyMessageDeserializerTest extends AbstractDeserializerT
         assertEquals(1, flowAndStatisticsMapList.getInstructions().getInstruction().size());
 
         final Instruction instruction =
-                flowAndStatisticsMapList.getInstructions().getInstruction().get(0).getInstruction();
+                flowAndStatisticsMapList.getInstructions().nonnullInstruction().values().iterator().next()
+                        .getInstruction();
         assertEquals(ApplyActionsCase.class, instruction.implementedInterface());
 
         final ApplyActionsCase applyActions = (ApplyActionsCase) instruction;
         assertEquals(1, applyActions.getApplyActions().getAction().size());
-        assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().getAction().get(0)
+        assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().nonnullAction().values().iterator().next()
                 .getAction().implementedInterface());
     }
 }
index 3de6d6443c7aea8d1fcdde2bb397695d06dd361b..bff961fee34de273b0fa9850acca40b881d606a0 100644 (file)
@@ -51,10 +51,11 @@ public class MultipartReplyMeterConfigDeserializerTest extends AbstractMultipart
 
         final MultipartReplyMeterConfig reply = (MultipartReplyMeterConfig) deserializeMultipart(buffer);
 
-        assertEquals(METER_ID, reply.getMeterConfigStats().get(0).getMeterId().getValue().intValue());
-        assertEquals(FLAGS, reply.getMeterConfigStats().get(0).getFlags());
-        final Drop drop = (Drop) reply.getMeterConfigStats().get(0)
-                .getMeterBandHeaders().getMeterBandHeader().get(0).getBandType();
+        assertEquals(METER_ID,
+            reply.nonnullMeterConfigStats().values().iterator().next().getMeterId().getValue().intValue());
+        assertEquals(FLAGS, reply.nonnullMeterConfigStats().values().iterator().next().getFlags());
+        final Drop drop = (Drop) reply.nonnullMeterConfigStats().values().iterator().next()
+                .getMeterBandHeaders().nonnullMeterBandHeader().values().iterator().next().getBandType();
         assertEquals(DROP_RATE, drop.getDropRate().intValue());
         assertEquals(DROP_BURST_SIZE, drop.getDropBurstSize().intValue());
     }
@@ -72,8 +73,8 @@ public class MultipartReplyMeterConfigDeserializerTest extends AbstractMultipart
 
         final MultipartReplyMeterConfig reply = (MultipartReplyMeterConfig) deserializeMultipart(buffer);
 
-        final DscpRemark dscpRemark = (DscpRemark) reply.getMeterConfigStats().get(0)
-                .getMeterBandHeaders().getMeterBandHeader().get(0).getBandType();
+        final DscpRemark dscpRemark = (DscpRemark) reply.nonnullMeterConfigStats().values().iterator().next()
+                .getMeterBandHeaders().nonnullMeterBandHeader().values().iterator().next().getBandType();
         assertEquals(DSCP_REMARK_RATE, dscpRemark.getDscpRemarkRate().intValue());
         assertEquals(DSCP_REMARK_BURST_SIZE, dscpRemark.getDscpRemarkBurstSize().intValue());
         assertEquals(PREC_LEVEL, dscpRemark.getPrecLevel().byteValue());
@@ -84,7 +85,7 @@ public class MultipartReplyMeterConfigDeserializerTest extends AbstractMultipart
         return MultipartType.OFPMPMETERCONFIG.getIntValue();
     }
 
-    private void writeCommonAtributes(ByteBuf buffer) {
+    private void writeCommonAtributes(final ByteBuf buffer) {
         buffer.writeShort(ITEM_LENGTH);
         buffer.writeShort(ByteBufUtils.fillBitMask(0,
                 FLAGS.isMeterKbps(),
index 725d4d7ff7010f7f4398af249cd61d3482a97f06..c4b4f64ebb4378c96f66f8f1a53336eca66a46a0 100644 (file)
@@ -45,7 +45,7 @@ public class MultipartReplyMeterStatsDeserializerTest extends AbstractMultipartD
 
         final MultipartReplyMeterStats reply = (MultipartReplyMeterStats) deserializeMultipart(buffer);
 
-        final MeterStats meterStats = reply.getMeterStats().get(0);
+        final MeterStats meterStats = reply.nonnullMeterStats().values().iterator().next();
 
         assertEquals(METER_ID, meterStats.getMeterId().getValue().intValue());
         assertEquals(FLOW_COUNT, meterStats.getFlowCount().getValue().intValue());
@@ -53,9 +53,9 @@ public class MultipartReplyMeterStatsDeserializerTest extends AbstractMultipartD
         assertEquals(BYTE_IN_COUNT, meterStats.getByteInCount().getValue().intValue());
         assertEquals(SECOND, meterStats.getDuration().getSecond().getValue().intValue());
         assertEquals(NANOSECOND, meterStats.getDuration().getNanosecond().getValue().intValue());
-        assertEquals(PACKET_BAND_COUNT, meterStats.getMeterBandStats().getBandStat().get(0)
+        assertEquals(PACKET_BAND_COUNT, meterStats.getMeterBandStats().nonnullBandStat().values().iterator().next()
                 .getPacketBandCount().getValue().longValue());
-        assertEquals(BYTE_BAND_COUNT, meterStats.getMeterBandStats().getBandStat().get(0)
+        assertEquals(BYTE_BAND_COUNT, meterStats.getMeterBandStats().nonnullBandStat().values().iterator().next()
                 .getByteBandCount().getValue().longValue());
         assertEquals(0, buffer.readableBytes());
     }
index e325e00b593b550fb91ae55547463747e9f0442b..2dcf012ff2c3547768180d065054591c2d226de0 100644 (file)
@@ -58,7 +58,7 @@ public class MultipartReplyPortStatsDeserializerTest extends AbstractMultipartDe
         final MultipartReplyPortStats reply = (MultipartReplyPortStats) deserializeMultipart(buffer);
 
         final NodeConnectorStatisticsAndPortNumberMap portStats =
-                reply.getNodeConnectorStatisticsAndPortNumberMap().get(0);
+                reply.nonnullNodeConnectorStatisticsAndPortNumberMap().values().iterator().next();
         assertEquals(PACKETS_RECEIVED, portStats.getPackets().getReceived().longValue());
         assertEquals(PACKETS_TRANSMITTED, portStats.getPackets().getTransmitted().longValue());
         assertEquals(BYTES_RECEIVED, portStats.getBytes().getReceived().longValue());
index feb8a0ef9a58ff892fe0abf1ef1242fedd510439..39649ba99aa85f1338ec4efb92783b518264664c 100644 (file)
@@ -39,7 +39,7 @@ public class MultipartReplyQueueStatsDeserializerTest extends AbstractMultipartD
 
         final MultipartReplyQueueStats reply = (MultipartReplyQueueStats) deserializeMultipart(buffer);
 
-        final QueueIdAndStatisticsMap queueStats = reply.getQueueIdAndStatisticsMap().get(0);
+        final QueueIdAndStatisticsMap queueStats = reply.nonnullQueueIdAndStatisticsMap().values().iterator().next();
 
         assertEquals(QUEUE_ID, queueStats.getQueueId().getValue().intValue());
         assertEquals(TRANSMITTED_BYTES, queueStats.getTransmittedBytes().getValue().longValue());
index e13577ad814439e6d3b48787bd8f02643b005273..1d0f62624826d338a6d2e2ddca486e90e242097e 100644 (file)
@@ -33,6 +33,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMiss;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfield;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMiss;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
 
 public class MultipartReplyTableFeaturesDeserializerTest extends AbstractMultipartDeserializerTest {
 
@@ -67,95 +68,111 @@ public class MultipartReplyTableFeaturesDeserializerTest extends AbstractMultipa
         writeValues(buffer, OFPTFPT_INSTRUCTIONS);
         MultipartReplyTableFeatures reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(TABLE_ID, reply.getTableFeatures().get(0).getTableId().byteValue());
-        assertEquals(METADATA_MATCH, reply.getTableFeatures().get(0).getMetadataMatch().longValue());
-        assertEquals(METADATA_WRITE, reply.getTableFeatures().get(0).getMetadataWrite().longValue());
-        assertEquals(MAX_ENTRIES, reply.getTableFeatures().get(0).getMaxEntries().longValue());
-        assertEquals(MAX_ENTRIES, reply.getTableFeatures().get(0).getMaxEntries().longValue());
-        assertEquals(Instructions.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        TableFeatures firstTableFeature = reply.nonnullTableFeatures().values().iterator().next();
+        assertEquals(TABLE_ID, firstTableFeature.getTableId().byteValue());
+        assertEquals(METADATA_MATCH, firstTableFeature.getMetadataMatch().longValue());
+        assertEquals(METADATA_WRITE, firstTableFeature.getMetadataWrite().longValue());
+        assertEquals(MAX_ENTRIES, firstTableFeature.getMaxEntries().longValue());
+        assertEquals(MAX_ENTRIES, firstTableFeature.getMaxEntries().longValue());
+        assertEquals(Instructions.class, firstTableFeature.getTableProperties()
+                .nonnullTableFeatureProperties().values().iterator().next().getTableFeaturePropType()
+                .implementedInterface());
 
         writeValues(buffer, OFPTFPT_INSTRUCTIONS_MISS);
         reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(InstructionsMiss.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        assertEquals(InstructionsMiss.class, reply.nonnullTableFeatures().values().iterator().next()
+                .getTableProperties().nonnullTableFeatureProperties().values().iterator().next()
+                .getTableFeaturePropType().implementedInterface());
 
         writeValues(buffer, OFPTFPT_NEXT_TABLES);
         reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(NextTable.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        assertEquals(NextTable.class, reply.nonnullTableFeatures().values().iterator().next().getTableProperties()
+                .nonnullTableFeatureProperties().values().iterator().next().getTableFeaturePropType()
+                .implementedInterface());
 
         writeValues(buffer, OFPTFPT_NEXT_TABLES_MISS);
         reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(NextTableMiss.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        assertEquals(NextTableMiss.class, reply.nonnullTableFeatures().values().iterator().next().getTableProperties()
+                .nonnullTableFeatureProperties().values().iterator().next().getTableFeaturePropType()
+                .implementedInterface());
 
         writeValues(buffer, OFPTFPT_WRITE_ACTIONS);
         reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(WriteActions.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        assertEquals(WriteActions.class, reply.nonnullTableFeatures().values().iterator().next().getTableProperties()
+                .nonnullTableFeatureProperties().values().iterator().next().getTableFeaturePropType()
+                .implementedInterface());
 
         writeValues(buffer, OFPTFPT_WRITE_ACTIONS_MISS);
         reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(WriteActionsMiss.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        assertEquals(WriteActionsMiss.class, reply.nonnullTableFeatures().values().iterator().next()
+                .getTableProperties().nonnullTableFeatureProperties().values().iterator().next()
+                .getTableFeaturePropType().implementedInterface());
 
         writeValues(buffer, OFPTFPT_APPLY_ACTIONS);
         reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(ApplyActions.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        assertEquals(ApplyActions.class, reply.nonnullTableFeatures().values().iterator().next().getTableProperties()
+                .nonnullTableFeatureProperties().values().iterator().next().getTableFeaturePropType()
+                .implementedInterface());
 
         writeValues(buffer, OFPTFPT_APPLY_ACTIONS_MISS);
         reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(ApplyActionsMiss.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        assertEquals(ApplyActionsMiss.class, reply.nonnullTableFeatures().values().iterator().next()
+                .getTableProperties().nonnullTableFeatureProperties().values().iterator().next()
+                .getTableFeaturePropType().implementedInterface());
 
         writeValues(buffer, OFPTFPT_MATCH);
         reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(Match.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        assertEquals(Match.class, reply.nonnullTableFeatures().values().iterator().next().getTableProperties()
+                .nonnullTableFeatureProperties().values().iterator().next().getTableFeaturePropType()
+                .implementedInterface());
 
         writeValues(buffer, OFPTFPT_WILDCARDS);
         reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(Wildcards.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        assertEquals(Wildcards.class, reply.nonnullTableFeatures().values().iterator().next().getTableProperties()
+                .nonnullTableFeatureProperties().values().iterator().next().getTableFeaturePropType()
+                .implementedInterface());
 
         writeValues(buffer, OFPTFPT_WRITE_SETFIELD);
         reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(WriteSetfield.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        assertEquals(WriteSetfield.class, reply.nonnullTableFeatures().values().iterator().next().getTableProperties()
+                .nonnullTableFeatureProperties().values().iterator().next().getTableFeaturePropType()
+                .implementedInterface());
 
         writeValues(buffer, OFPTFPT_WRITE_SETFIELD_MISS);
         reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(WriteSetfieldMiss.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        assertEquals(WriteSetfieldMiss.class, reply.nonnullTableFeatures().values().iterator().next()
+                .getTableProperties().nonnullTableFeatureProperties().values().iterator().next()
+                .getTableFeaturePropType().implementedInterface());
 
         writeValues(buffer, OFPTFPT_APPLY_SETFIELD);
         reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(ApplySetfield.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        assertEquals(ApplySetfield.class, reply.nonnullTableFeatures().values().iterator().next().getTableProperties()
+                .nonnullTableFeatureProperties().values().iterator().next().getTableFeaturePropType()
+                .implementedInterface());
 
         writeValues(buffer, OFPTFPT_APPLY_SETFIELD_MISS);
         reply = (MultipartReplyTableFeatures) deserializeMultipart(buffer);
 
-        assertEquals(ApplySetfieldMiss.class, reply.getTableFeatures().get(0).getTableProperties()
-                .getTableFeatureProperties().get(0).getTableFeaturePropType().implementedInterface());
+        assertEquals(ApplySetfieldMiss.class, reply.nonnullTableFeatures().values().iterator().next()
+                .getTableProperties().nonnullTableFeatureProperties().values().iterator().next()
+                .getTableFeaturePropType().implementedInterface());
         assertEquals(0, buffer.readableBytes());
     }
 
-    private void writeValues(ByteBuf buffer, int propertyType) {
+
+    private static void writeValues(final ByteBuf buffer, final int propertyType) {
         buffer.clear();
         final int replyIndex = buffer.readerIndex();
         buffer.writeShort(EncodeConstants.EMPTY_LENGTH);
index 4d68b236837f8d31dd4668c7e8d65b34cbafa5b8..cf9a024d8c6a1940b712bd2efb28404ab1fd4072 100644 (file)
@@ -113,8 +113,8 @@ public class FlowMessageSerializerTest extends AbstractSerializerTest {
                             .setInstruction(new ApplyActionsCaseBuilder()
                                     .setApplyActions(new ApplyActionsBuilder()
                                             .setAction(Collections.singletonList(new ActionBuilder()
-                                                    .setOrder(0)
-                                                    .withKey(new ActionKey(0))
+                                                    .setOrder(1)
+                                                    .withKey(new ActionKey(1))
                                                     .setAction(new SetTpDstActionCaseBuilder()
                                                             .setSetTpDstAction(new SetTpDstActionBuilder()
                                                                     .setIpProtocol(IP_PROTOCOL)
@@ -131,8 +131,8 @@ public class FlowMessageSerializerTest extends AbstractSerializerTest {
                             .setInstruction(new ApplyActionsCaseBuilder()
                                     .setApplyActions(new ApplyActionsBuilder()
                                             .setAction(Collections.singletonList(new ActionBuilder()
-                                                    .setOrder(0)
-                                                    .withKey(new ActionKey(0))
+                                                    .setOrder(2)
+                                                    .withKey(new ActionKey(2))
                                                     .setAction(new SetTpSrcActionCaseBuilder()
                                                             .setSetTpSrcAction(new SetTpSrcActionBuilder()
                                                                     .setIpProtocol(IP_PROTOCOL)
index ec98addc644f8c10b33b269b01b10b98f2f878a0..6786b2bae3cbb9a2d0132574c0def807f091ac13 100644 (file)
@@ -27,6 +27,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.DscpRemarkBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.MeterBandHeadersBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeaderBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeaderKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.meter.band.header.MeterBandTypesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterBandType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterModCommand;
@@ -77,7 +78,7 @@ public class MeterMessageSerializerTest extends AbstractSerializerTest {
                                                     .meter.types.rev130918.MeterBandType(true, false, false))
                                             .build())
                                     .setBandBurstSize(BAND_BURST_SIZE)
-                                    .setBandId(new BandId(BAND_ID))
+                                    .withKey(new MeterBandHeaderKey(new BandId(BAND_ID)))
                                     .setBandRate(BAND_RATE)
                                     .setBandType(new DropBuilder()
                                             .setDropRate(DROP_RATE)
@@ -90,7 +91,7 @@ public class MeterMessageSerializerTest extends AbstractSerializerTest {
                                                     .meter.types.rev130918.MeterBandType(false, true, false))
                                             .build())
                                     .setBandBurstSize(BAND_BURST_SIZE)
-                                    .setBandId(new BandId(BAND_ID))
+                                    .withKey(new MeterBandHeaderKey(new BandId(BAND_ID + 1)))
                                     .setBandRate(BAND_RATE)
                                     .setBandType(new DscpRemarkBuilder()
                                             .setDscpRemarkBurstSize(DSCP_BURST_SIZE)
index b661294a2f8b66210dfcabb4cc70d188850c9476..01751cf99ae8c76dcdfed0691a2008fbc8a09985 100644 (file)
@@ -126,23 +126,19 @@ public class DeviceFlowRegistryImplTest {
 
         fillRegistry(path, null);
 
-        fillRegistry(path, new FlowCapableNodeBuilder()
-                .setTable(null)
-                .build());
+        fillRegistry(path, new FlowCapableNodeBuilder().build());
 
         fillRegistry(path, new FlowCapableNodeBuilder()
-                .setTable(Collections.singletonList(null))
+                .setTable(Collections.EMPTY_LIST)
                 .build());
 
         fillRegistry(path, new FlowCapableNodeBuilder()
-                .setTable(Collections.singletonList(new TableBuilder()
-                        .setFlow(null)
-                        .build()))
+                .setTable(Collections.singletonList(new TableBuilder().build()))
                 .build());
 
         fillRegistry(path, new FlowCapableNodeBuilder()
                 .setTable(Collections.singletonList(new TableBuilder()
-                        .setFlow(Collections.singletonList(null))
+                        .setFlow(Collections.EMPTY_LIST)
                         .build()))
                 .build());
 
index 0a00ece93bd293de46e11e9a70b79c1e04eda7d5..ae03f75565b504bef29d80ec2664218fd4306d03 100644 (file)
@@ -72,7 +72,7 @@ public class FlowRegistryKeyFactoryTest {
         FlowsStatisticsUpdate flowStats = FLOWS_STATISTICS_UPDATE_BUILDER.build();
 
         HashSet<FlowRegistryKey> flowRegistryKeys = new HashSet<>();
-        for (FlowAndStatisticsMapList item : flowStats.getFlowAndStatisticsMapList()) {
+        for (FlowAndStatisticsMapList item : flowStats.nonnullFlowAndStatisticsMapList().values()) {
             final FlowRegistryKey key1 = FlowRegistryKeyFactory.create(deviceInfo.getVersion(), item);
             final FlowRegistryKey key2 = FlowRegistryKeyFactory.create(deviceInfo.getVersion(), item);
             flowRegistryKeys.add(key1);
@@ -178,7 +178,7 @@ public class FlowRegistryKeyFactoryTest {
     public void testGetHash() {
         FlowsStatisticsUpdate flowStats = FLOWS_STATISTICS_UPDATE_BUILDER.build();
 
-        for (FlowAndStatisticsMapList item : flowStats.getFlowAndStatisticsMapList()) {
+        for (FlowAndStatisticsMapList item : flowStats.nonnullFlowAndStatisticsMapList().values()) {
             FlowRegistryKey flowRegistryKey = FlowRegistryKeyFactory.create(deviceInfo.getVersion(), item);
             FlowRegistryKey lastHash = null;
             if (null != lastHash) {
index 599242e1d9ea18ae7f2091664ee317dfca41908f..0b838129f18c150df26e2314dcf08057ee5f1afe 100644 (file)
@@ -10,7 +10,9 @@ package org.opendaylight.openflowplugin.impl.registry.flow;
 
 import java.math.BigInteger;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
@@ -51,6 +53,7 @@ public final class TestFlowHelper {
         matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
 
         flowAndStatisticsMapListBuilder.setMatch(matchBuilder.build());
+        flowAndStatisticsMapListBuilder.withKey(new FlowAndStatisticsMapListKey(new FlowId(String.valueOf(index))));
         return flowAndStatisticsMapListBuilder;
     }
 }
index 401bac48567b79e88fcdd9eb7181f1636d2abd12..ab836d1405553b33aa0759e0a86e8913e4cf7556 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.openflowplugin.impl.services.batch;
 
 import com.google.common.collect.Lists;
+import java.util.Iterator;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.ProcessFlatBatchOutput;
@@ -28,8 +29,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.Add
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.BatchFlowOutputListGrouping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.RemoveFlowsBatchInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.UpdateFlowsBatchInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.add.flows.batch.input.BatchAddFlows;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.batch.flow.output.list.grouping.BatchFailedFlowsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.batch.flow.output.list.grouping.BatchFailedFlowsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.remove.flows.batch.input.BatchRemoveFlows;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.update.flows.batch.input.BatchUpdateFlows;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
@@ -59,11 +63,12 @@ public class FlatBatchFlowAdaptersTest {
                 createAddFlowBatch("2")));
 
         final AddFlowsBatchInput addFlowsBatchInput = FlatBatchFlowAdapters.adaptFlatBatchAddFlow(planStep, NODE_REF);
+        Iterator<BatchAddFlows> iterator = addFlowsBatchInput.nonnullBatchAddFlows().values().iterator();
 
         Assert.assertTrue(addFlowsBatchInput.isBarrierAfter());
         Assert.assertEquals(2, addFlowsBatchInput.getBatchAddFlows().size());
-        Assert.assertEquals("1", addFlowsBatchInput.getBatchAddFlows().get(0).getFlowId().getValue());
-        Assert.assertEquals("2", addFlowsBatchInput.getBatchAddFlows().get(1).getFlowId().getValue());
+        Assert.assertEquals("1", iterator.next().getFlowId().getValue());
+        Assert.assertEquals("2", iterator.next().getFlowId().getValue());
     }
 
     private FlatBatchAddFlow createAddFlowBatch(final String flowIdValue) {
@@ -94,11 +99,12 @@ public class FlatBatchFlowAdaptersTest {
 
         final RemoveFlowsBatchInput removeFlowsBatchInput =
                 FlatBatchFlowAdapters.adaptFlatBatchRemoveFlow(planStep, NODE_REF);
+        Iterator<BatchRemoveFlows> iterator = removeFlowsBatchInput.nonnullBatchRemoveFlows().values().iterator();
 
         Assert.assertTrue(removeFlowsBatchInput.isBarrierAfter());
         Assert.assertEquals(2, removeFlowsBatchInput.getBatchRemoveFlows().size());
-        Assert.assertEquals("1", removeFlowsBatchInput.getBatchRemoveFlows().get(0).getFlowId().getValue());
-        Assert.assertEquals("2", removeFlowsBatchInput.getBatchRemoveFlows().get(1).getFlowId().getValue());
+        Assert.assertEquals("1", iterator.next().getFlowId().getValue());
+        Assert.assertEquals("2", iterator.next().getFlowId().getValue());
     }
 
     @Test
@@ -111,11 +117,12 @@ public class FlatBatchFlowAdaptersTest {
 
         final UpdateFlowsBatchInput updateFlowsBatchInput =
                 FlatBatchFlowAdapters.adaptFlatBatchUpdateFlow(planStep, NODE_REF);
+        Iterator<BatchUpdateFlows> iterator = updateFlowsBatchInput.nonnullBatchUpdateFlows().values().iterator();
 
         Assert.assertTrue(updateFlowsBatchInput.isBarrierAfter());
         Assert.assertEquals(2, updateFlowsBatchInput.getBatchUpdateFlows().size());
-        Assert.assertEquals("1", updateFlowsBatchInput.getBatchUpdateFlows().get(0).getFlowId().getValue());
-        Assert.assertEquals("2", updateFlowsBatchInput.getBatchUpdateFlows().get(1).getFlowId().getValue());
+        Assert.assertEquals("1", iterator.next().getFlowId().getValue());
+        Assert.assertEquals("2", iterator.next().getFlowId().getValue());
     }
 
     @Test
@@ -132,14 +139,17 @@ public class FlatBatchFlowAdaptersTest {
 
         final RpcResult<ProcessFlatBatchOutput> rpcResult = FlatBatchFlowAdapters
                 .convertBatchFlowResult(3).apply(input);
+        Iterator<BatchFailure> iterator = rpcResult.getResult().nonnullBatchFailure().values().iterator();
 
         Assert.assertFalse(rpcResult.isSuccessful());
         Assert.assertEquals(1, rpcResult.getErrors().size());
         Assert.assertEquals(2, rpcResult.getResult().getBatchFailure().size());
-        Assert.assertEquals(3, rpcResult.getResult().getBatchFailure().get(0).getBatchOrder().intValue());
-        Assert.assertEquals(4, rpcResult.getResult().getBatchFailure().get(1).getBatchOrder().intValue());
+        Assert.assertEquals(3, iterator.next()
+                .getBatchOrder().intValue());
+        BatchFailure secondBatchFailure = iterator.next();
+        Assert.assertEquals(4, secondBatchFailure.getBatchOrder().intValue());
         Assert.assertEquals("f2",
-                ((FlatBatchFailureFlowIdCase) rpcResult.getResult().getBatchFailure().get(1).getBatchItemIdChoice())
+                ((FlatBatchFailureFlowIdCase) secondBatchFailure.getBatchItemIdChoice())
                         .getFlowId().getValue());
     }
 
@@ -154,7 +164,7 @@ public class FlatBatchFlowAdaptersTest {
 
         Assert.assertTrue(rpcResult.isSuccessful());
         Assert.assertEquals(0, rpcResult.getErrors().size());
-        Assert.assertEquals(0, rpcResult.getResult().getBatchFailure().size());
+        Assert.assertEquals(0, rpcResult.getResult().nonnullBatchFailure().size());
     }
 
     private BatchFailedFlowsOutput createBatchFailedFlowsOutput(final Integer batchOrder, final String flowIdValue) {
index e3a403caa5dac90acadc073d5d6153db4a281809..4a6126f307da4851e15ef821a2eed12abdea13b1 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.openflowplugin.impl.services.batch;
 
 import com.google.common.collect.Lists;
+import java.util.Iterator;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.ProcessFlatBatchOutput;
@@ -28,10 +29,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.Ad
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.BatchGroupOutputListGrouping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.RemoveGroupsBatchInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.UpdateGroupsBatchInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.add.groups.batch.input.BatchAddGroups;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.batch.group.input.update.grouping.OriginalBatchedGroupBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.batch.group.input.update.grouping.UpdatedBatchedGroupBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.batch.group.output.list.grouping.BatchFailedGroupsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.batch.group.output.list.grouping.BatchFailedGroupsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.remove.groups.batch.input.BatchRemoveGroups;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
@@ -62,11 +65,12 @@ public class FlatBatchGroupAdaptersTest {
 
         final AddGroupsBatchInput addGroupsBatchInput =
                 FlatBatchGroupAdapters.adaptFlatBatchAddGroup(planStep, NODE_REF);
+        Iterator<BatchAddGroups> iterator = addGroupsBatchInput.nonnullBatchAddGroups().values().iterator();
 
         Assert.assertTrue(addGroupsBatchInput.isBarrierAfter());
         Assert.assertEquals(2, addGroupsBatchInput.getBatchAddGroups().size());
-        Assert.assertEquals(1L, addGroupsBatchInput.getBatchAddGroups().get(0).getGroupId().getValue().longValue());
-        Assert.assertEquals(2L, addGroupsBatchInput.getBatchAddGroups().get(1).getGroupId().getValue().longValue());
+        Assert.assertEquals(1L, iterator.next().getGroupId().getValue().longValue());
+        Assert.assertEquals(2L, iterator.next().getGroupId().getValue().longValue());
     }
 
     private FlatBatchAddGroup createAddGroupBatch(final long groupIdValue) {
@@ -102,13 +106,12 @@ public class FlatBatchGroupAdaptersTest {
 
         final RemoveGroupsBatchInput removeGroupsBatchInput =
                 FlatBatchGroupAdapters.adaptFlatBatchRemoveGroup(planStep, NODE_REF);
+        Iterator<BatchRemoveGroups> iterator = removeGroupsBatchInput.nonnullBatchRemoveGroups().values().iterator();
 
         Assert.assertTrue(removeGroupsBatchInput.isBarrierAfter());
         Assert.assertEquals(2, removeGroupsBatchInput.getBatchRemoveGroups().size());
-        Assert.assertEquals(1L,
-                removeGroupsBatchInput.getBatchRemoveGroups().get(0).getGroupId().getValue().longValue());
-        Assert.assertEquals(2L,
-                removeGroupsBatchInput.getBatchRemoveGroups().get(1).getGroupId().getValue().longValue());
+        Assert.assertEquals(1L, iterator.next().getGroupId().getValue().longValue());
+        Assert.assertEquals(2L, iterator.next().getGroupId().getValue().longValue());
     }
 
     @Test
@@ -144,13 +147,15 @@ public class FlatBatchGroupAdaptersTest {
 
         final RpcResult<ProcessFlatBatchOutput> rpcResult = FlatBatchGroupAdapters
                 .convertBatchGroupResult(3).apply(input);
+        Iterator<BatchFailure> iterator = rpcResult.getResult().nonnullBatchFailure().values().iterator();
 
         Assert.assertFalse(rpcResult.isSuccessful());
         Assert.assertEquals(1, rpcResult.getErrors().size());
-        Assert.assertEquals(2, rpcResult.getResult().getBatchFailure().size());
-        Assert.assertEquals(3, rpcResult.getResult().getBatchFailure().get(0).getBatchOrder().intValue());
-        Assert.assertEquals(4, rpcResult.getResult().getBatchFailure().get(1).getBatchOrder().intValue());
-        Assert.assertEquals(2L, ((FlatBatchFailureGroupIdCase) rpcResult.getResult().getBatchFailure().get(1)
+        Assert.assertEquals(2, rpcResult.getResult().nonnullBatchFailure().size());
+        Assert.assertEquals(3, iterator.next().getBatchOrder().intValue());
+        BatchFailure secondBatchFailure = iterator.next();
+        Assert.assertEquals(4, secondBatchFailure.getBatchOrder().intValue());
+        Assert.assertEquals(2L, ((FlatBatchFailureGroupIdCase) secondBatchFailure
                 .getBatchItemIdChoice()).getGroupId().getValue().longValue());
     }
 
@@ -165,7 +170,7 @@ public class FlatBatchGroupAdaptersTest {
 
         Assert.assertTrue(rpcResult.isSuccessful());
         Assert.assertEquals(0, rpcResult.getErrors().size());
-        Assert.assertEquals(0, rpcResult.getResult().getBatchFailure().size());
+        Assert.assertEquals(0, rpcResult.getResult().nonnullBatchFailure().size());
     }
 
     private BatchFailedGroupsOutput createBatchFailedGroupsOutput(final Integer batchOrder, final long groupIdValue) {
index bf487d3e7e6e22b2f2faa7c67add03f231928416..ff9f50740f1f6840386a2d717fd63e825f1a602d 100644 (file)
@@ -5,10 +5,10 @@
  * 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.openflowplugin.impl.services.batch;
 
 import com.google.common.collect.Lists;
+import java.util.Iterator;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.ProcessFlatBatchOutput;
@@ -33,10 +33,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.Ad
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.BatchMeterOutputListGrouping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.RemoveMetersBatchInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.UpdateMetersBatchInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.add.meters.batch.input.BatchAddMeters;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.input.update.grouping.OriginalBatchedMeterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.input.update.grouping.UpdatedBatchedMeterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.output.list.grouping.BatchFailedMetersOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.output.list.grouping.BatchFailedMetersOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.remove.meters.batch.input.BatchRemoveMeters;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -64,9 +66,11 @@ public class FlatBatchMeterAdaptersTest {
                 FlatBatchMeterAdapters.adaptFlatBatchAddMeter(planStep, NODE_REF);
 
         Assert.assertTrue(addMetersBatchInput.isBarrierAfter());
-        Assert.assertEquals(2, addMetersBatchInput.getBatchAddMeters().size());
-        Assert.assertEquals(1L, addMetersBatchInput.getBatchAddMeters().get(0).getMeterId().getValue().longValue());
-        Assert.assertEquals(2L, addMetersBatchInput.getBatchAddMeters().get(1).getMeterId().getValue().longValue());
+        Assert.assertEquals(2, addMetersBatchInput.nonnullBatchAddMeters().size());
+        final Iterator<BatchAddMeters> it = addMetersBatchInput.nonnullBatchAddMeters().values().iterator();
+
+        Assert.assertEquals(1L, it.next().getMeterId().getValue().longValue());
+        Assert.assertEquals(2L, it.next().getMeterId().getValue().longValue());
     }
 
     private FlatBatchAddMeter createAddMeterBatch(final long groupIdValue) {
@@ -102,13 +106,12 @@ public class FlatBatchMeterAdaptersTest {
 
         final RemoveMetersBatchInput removeMetersBatchInput =
                 FlatBatchMeterAdapters.adaptFlatBatchRemoveMeter(planStep, NODE_REF);
+        Iterator<BatchRemoveMeters> iterator = removeMetersBatchInput.nonnullBatchRemoveMeters().values().iterator();
 
         Assert.assertTrue(removeMetersBatchInput.isBarrierAfter());
-        Assert.assertEquals(2, removeMetersBatchInput.getBatchRemoveMeters().size());
-        Assert.assertEquals(1L,
-                removeMetersBatchInput.getBatchRemoveMeters().get(0).getMeterId().getValue().longValue());
-        Assert.assertEquals(2L,
-                removeMetersBatchInput.getBatchRemoveMeters().get(1).getMeterId().getValue().longValue());
+        Assert.assertEquals(2, removeMetersBatchInput.nonnullBatchRemoveMeters().size());
+        Assert.assertEquals(1L, iterator.next().getMeterId().getValue().longValue());
+        Assert.assertEquals(2L, iterator.next().getMeterId().getValue().longValue());
     }
 
     @Test
@@ -144,13 +147,15 @@ public class FlatBatchMeterAdaptersTest {
 
         final RpcResult<ProcessFlatBatchOutput> rpcResult = FlatBatchMeterAdapters
                 .convertBatchMeterResult(3).apply(input);
+        Iterator<BatchFailure> iterator = rpcResult.getResult().nonnullBatchFailure().values().iterator();
 
         Assert.assertFalse(rpcResult.isSuccessful());
         Assert.assertEquals(1, rpcResult.getErrors().size());
-        Assert.assertEquals(2, rpcResult.getResult().getBatchFailure().size());
-        Assert.assertEquals(3, rpcResult.getResult().getBatchFailure().get(0).getBatchOrder().intValue());
-        Assert.assertEquals(4, rpcResult.getResult().getBatchFailure().get(1).getBatchOrder().intValue());
-        Assert.assertEquals(2L, ((FlatBatchFailureMeterIdCase) rpcResult.getResult().getBatchFailure().get(1)
+        Assert.assertEquals(2, rpcResult.getResult().nonnullBatchFailure().size());
+        Assert.assertEquals(3, iterator.next().getBatchOrder().intValue());
+        BatchFailure secondBatchFailure = iterator.next();
+        Assert.assertEquals(4, secondBatchFailure.getBatchOrder().intValue());
+        Assert.assertEquals(2L, ((FlatBatchFailureMeterIdCase) secondBatchFailure
                 .getBatchItemIdChoice()).getMeterId().getValue().longValue());
     }
 
@@ -165,7 +170,7 @@ public class FlatBatchMeterAdaptersTest {
 
         Assert.assertTrue(rpcResult.isSuccessful());
         Assert.assertEquals(0, rpcResult.getErrors().size());
-        Assert.assertEquals(0, rpcResult.getResult().getBatchFailure().size());
+        Assert.assertEquals(0, rpcResult.getResult().nonnullBatchFailure().size());
     }
 
     private BatchFailedMetersOutput createBatchFailedMetersOutput(final Integer batchOrder, final long groupIdValue) {
index 133ba53c6187ab9767ab71d375683e235e2fe1bb..47fcbea795472a701e5d8ad2ef699e706a6fe032 100644 (file)
@@ -22,7 +22,6 @@ public class SalExperimenterMpMessageServiceImplTest extends ServiceMocking {
     private SalExperimenterMpMessageServiceImpl salExperimenterMpMessageService;
 
     @Override
-    @SuppressWarnings("unchecked")
     protected void setup() {
         this.<List<MultipartReply>>mockSuccessfulFuture();
 
index 6b1752637c5c90efe582c0c9e28d08357c98ca00..dc02350ad61ca54bf06d9fed6f0fb2db2bbe9f02 100644 (file)
@@ -13,6 +13,7 @@ import com.google.common.util.concurrent.AsyncFunction;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.Future;
 import org.junit.After;
@@ -37,6 +38,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev16032
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.ProcessFlatBatchOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.Batch;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.BatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.BatchKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchAddFlowCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchAddGroupCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchAddMeterCaseBuilder;
@@ -48,6 +50,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev16032
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchUpdateMeterCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.flow._case.FlatBatchAddFlow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.flow._case.FlatBatchAddFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.flow._case.FlatBatchAddFlowKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.group._case.FlatBatchAddGroupBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.meter._case.FlatBatchAddMeterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.flow._case.FlatBatchRemoveFlowBuilder;
@@ -162,9 +165,9 @@ public class SalFlatBatchServiceImplTest {
                         createGroupRemoveBatch(4, 2L),
                         createGroupUpdateBatch(5, 3L),
 
-                        createMeterAddBatch(3, 1L),
-                        createMeterRemoveBatch(4, 2L),
-                        createMeterUpdateBatch(5, 3L)
+                        createMeterAddBatch(6, 1L),
+                        createMeterRemoveBatch(7, 2L),
+                        createMeterUpdateBatch(8, 3L)
                 ))
                 .setExitOnFirstError(true)
                 .build();
@@ -175,7 +178,7 @@ public class SalFlatBatchServiceImplTest {
         final RpcResult<ProcessFlatBatchOutput> rpcResult = rpcResultFuture.get();
         Assert.assertTrue(rpcResult.isSuccessful());
         Assert.assertTrue(rpcResult.getErrors().isEmpty());
-        Assert.assertTrue(rpcResult.getResult().getBatchFailure().isEmpty());
+        Assert.assertTrue(rpcResult.getResult().nonnullBatchFailure().isEmpty());
 
         final InOrder inOrder = Mockito.inOrder(salFlowsBatchService, salGroupsBatchService, salMetersBatchService);
         inOrder.verify(salFlowsBatchService).addFlowsBatch(ArgumentMatchers.any());
@@ -220,8 +223,9 @@ public class SalFlatBatchServiceImplTest {
         final RpcResult<ProcessFlatBatchOutput> rpcResult = rpcResultFuture.get();
         Assert.assertFalse(rpcResult.isSuccessful());
         Assert.assertEquals(1, rpcResult.getErrors().size());
-        Assert.assertEquals(1, rpcResult.getResult().getBatchFailure().size());
-        Assert.assertEquals(3, rpcResult.getResult().getBatchFailure().get(0).getBatchOrder().intValue());
+        Assert.assertEquals(1, rpcResult.getResult().nonnullBatchFailure().size());
+        Assert.assertEquals(3, rpcResult.getResult().nonnullBatchFailure().values().iterator().next()
+                .getBatchOrder().intValue());
 
         final InOrder inOrder = Mockito.inOrder(salFlowsBatchService, salGroupsBatchService, salMetersBatchService);
         inOrder.verify(salFlowsBatchService).addFlowsBatch(ArgumentMatchers.any());
@@ -259,8 +263,9 @@ public class SalFlatBatchServiceImplTest {
         final RpcResult<ProcessFlatBatchOutput> rpcResult = rpcResultFuture.get();
         Assert.assertFalse(rpcResult.isSuccessful());
         Assert.assertEquals(1, rpcResult.getErrors().size());
-        Assert.assertEquals(1, rpcResult.getResult().getBatchFailure().size());
-        Assert.assertEquals(3, rpcResult.getResult().getBatchFailure().get(0).getBatchOrder().intValue());
+        Assert.assertEquals(1, rpcResult.getResult().nonnullBatchFailure().size());
+        Assert.assertEquals(3, rpcResult.getResult().nonnullBatchFailure().values().iterator().next()
+                .getBatchOrder().intValue());
 
         final InOrder inOrder = Mockito.inOrder(salFlowsBatchService, salGroupsBatchService, salMetersBatchService);
         inOrder.verify(salFlowsBatchService).addFlowsBatch(ArgumentMatchers.any());
@@ -312,17 +317,26 @@ public class SalFlatBatchServiceImplTest {
         return createFlowAddBatch(batchOrder, flowIdValue, 1);
     }
 
-    private Batch createFlowAddBatch(final int batchOrder, final String flowIdValue, int amount) {
+    private Batch createFlowAddBatch(final int batchOrder, final String flowIdValue, final int amount) {
         return new BatchBuilder()
                 .setBatchOrder(batchOrder)
                 .setBatchChoice(new FlatBatchAddFlowCaseBuilder()
-                        .setFlatBatchAddFlow(repeatInList(new FlatBatchAddFlowBuilder()
-                                .setFlowId(new FlowId(flowIdValue))
-                                .build(), amount))
+                        .setFlatBatchAddFlow(repeatFlatBatchAddFlowInList(flowIdValue, amount))
                         .build())
                 .build();
     }
 
+    private List<FlatBatchAddFlow> repeatFlatBatchAddFlowInList(final String flowIdValue, final int amount) {
+        final List<FlatBatchAddFlow> list = new ArrayList<>();
+        for (int i = 0; i < amount; i++) {
+            list.add(new FlatBatchAddFlowBuilder()
+                    .setFlowId(new FlowId(flowIdValue + i))
+                    .withKey(new FlatBatchAddFlowKey(i))
+                    .build());
+        }
+        return list;
+    }
+
     private <T> List<T> repeatInList(final T item, final int amount) {
         final List<T> list = new ArrayList<>();
         for (int i = 0; i < amount; i++) {
@@ -345,6 +359,7 @@ public class SalFlatBatchServiceImplTest {
     private Batch createFlowUpdateBatch(final int batchOrder, final String flowIdValue) {
         return new BatchBuilder()
                 .setBatchOrder(batchOrder)
+                .withKey(new BatchKey(batchOrder))
                 .setBatchChoice(new FlatBatchUpdateFlowCaseBuilder()
                         .setFlatBatchUpdateFlow(Collections.singletonList(new FlatBatchUpdateFlowBuilder()
                                 .setFlowId(new FlowId(flowIdValue))
@@ -468,9 +483,12 @@ public class SalFlatBatchServiceImplTest {
         final RpcResult<ProcessFlatBatchOutput> rpcResult = rpcResultFuture.get();
         Assert.assertFalse(rpcResult.isSuccessful());
         Assert.assertEquals(1, rpcResult.getErrors().size());
-        Assert.assertEquals(2, rpcResult.getResult().getBatchFailure().size());
+        Assert.assertEquals(2, rpcResult.getResult().nonnullBatchFailure().size());
+        Iterator<BatchFailure> iterator = rpcResult.getResult().nonnullBatchFailure().values().iterator();
+        //Moving iterator two get second element
+        iterator.next();
         Assert.assertEquals("f2",
-                ((FlatBatchFailureFlowIdCase) rpcResult.getResult().getBatchFailure().get(1).getBatchItemIdChoice())
+                ((FlatBatchFailureFlowIdCase) iterator.next().getBatchItemIdChoice())
                         .getFlowId().getValue());
     }
 
@@ -483,7 +501,7 @@ public class SalFlatBatchServiceImplTest {
                 .build();
     }
 
-    private ProcessFlatBatchOutput createFlatBatchOutput(BatchFailure... batchFailures) {
+    private ProcessFlatBatchOutput createFlatBatchOutput(final BatchFailure... batchFailures) {
         return new ProcessFlatBatchOutputBuilder()
                 .setBatchFailure(Lists.newArrayList(batchFailures))
                 .build();
@@ -491,11 +509,14 @@ public class SalFlatBatchServiceImplTest {
 
     @Test
     public void testPrepareBatchPlan_success() throws Exception {
-        final FlatBatchAddFlow flatBatchAddFlow = new FlatBatchAddFlowBuilder()
+        final FlatBatchAddFlow flatBatchAddFlow_1 = new FlatBatchAddFlowBuilder()
                 .setFlowId(new FlowId("f1"))
                 .build();
+        final FlatBatchAddFlow flatBatchAddFlow_2 = new FlatBatchAddFlowBuilder()
+                .setFlowId(new FlowId("f2"))
+                .build();
         final BatchPlanStep batchPlanStep = new BatchPlanStep(BatchStepType.FLOW_ADD);
-        batchPlanStep.getTaskBag().addAll(Lists.newArrayList(flatBatchAddFlow, flatBatchAddFlow));
+        batchPlanStep.getTaskBag().addAll(Lists.newArrayList(flatBatchAddFlow_1, flatBatchAddFlow_2));
         final List<BatchPlanStep> batchPlan = Lists.newArrayList(batchPlanStep);
 
         final List<BatchStepJob> batchChain = salFlatBatchService.prepareBatchChain(batchPlan, NODE_REF, true);
@@ -513,18 +534,21 @@ public class SalFlatBatchServiceImplTest {
         final RpcResult<ProcessFlatBatchOutput> rpcResult = rpcResultFuture.get();
         Assert.assertTrue(rpcResult.isSuccessful());
         Assert.assertEquals(0, rpcResult.getErrors().size());
-        Assert.assertEquals(0, rpcResult.getResult().getBatchFailure().size());
+        Assert.assertEquals(0, rpcResult.getResult().nonnullBatchFailure().size());
 
         Mockito.verify(salFlowsBatchService).addFlowsBatch(ArgumentMatchers.any());
     }
 
     @Test
     public void testPrepareBatchPlan_failure() throws Exception {
-        final FlatBatchAddFlow flatBatchAddFlow = new FlatBatchAddFlowBuilder()
+        final FlatBatchAddFlow flatBatchAddFlow_1 = new FlatBatchAddFlowBuilder()
                 .setFlowId(new FlowId("f1"))
                 .build();
+        final FlatBatchAddFlow flatBatchAddFlow_2 = new FlatBatchAddFlowBuilder()
+                .setFlowId(new FlowId("f2"))
+                .build();
         final BatchPlanStep batchPlanStep = new BatchPlanStep(BatchStepType.FLOW_ADD);
-        batchPlanStep.getTaskBag().addAll(Lists.newArrayList(flatBatchAddFlow, flatBatchAddFlow));
+        batchPlanStep.getTaskBag().addAll(Lists.newArrayList(flatBatchAddFlow_1, flatBatchAddFlow_2));
 
         final List<BatchPlanStep> batchPlan = Lists.newArrayList(batchPlanStep, batchPlanStep);
 
index c1766abe726192a6c4223721b8b24e2e3edb925d..145d802a254285e048f101a4d8fbb60c3799329f 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.openflowplugin.impl.services.sal;
 
 import com.google.common.collect.Lists;
+import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.Future;
 import org.junit.After;
@@ -50,6 +51,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.add
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.add.flows.batch.input.BatchAddFlowsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.batch.flow.input.update.grouping.OriginalBatchedFlowBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.batch.flow.input.update.grouping.UpdatedBatchedFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.batch.flow.output.list.grouping.BatchFailedFlowsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.remove.flows.batch.input.BatchRemoveFlows;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.remove.flows.batch.input.BatchRemoveFlowsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.update.flows.batch.input.BatchUpdateFlows;
@@ -130,7 +132,7 @@ public class SalFlowsBatchServiceImplTest {
         final RpcResult<RemoveFlowsBatchOutput> rpcResult = resultFuture.get();
         Assert.assertTrue(rpcResult.isSuccessful());
         final RemoveFlowsBatchOutput result = rpcResult.getResult();
-        Assert.assertEquals(0, result.getBatchFailedFlowsOutput().size());
+        Assert.assertEquals(0, result.nonnullBatchFailedFlowsOutput().size());
 
         final InOrder inOrder = Mockito.inOrder(salFlowService, transactionService);
 
@@ -165,9 +167,10 @@ public class SalFlowsBatchServiceImplTest {
         final RpcResult<RemoveFlowsBatchOutput> rpcResult = resultFuture.get();
         Assert.assertFalse(rpcResult.isSuccessful());
         final RemoveFlowsBatchOutput result = rpcResult.getResult();
-        Assert.assertEquals(2, result.getBatchFailedFlowsOutput().size());
-        Assert.assertEquals(FLOW_ID_VALUE_1, result.getBatchFailedFlowsOutput().get(0).getFlowId().getValue());
-        Assert.assertEquals(FLOW_ID_VALUE_2, result.getBatchFailedFlowsOutput().get(1).getFlowId().getValue());
+        Iterator<BatchFailedFlowsOutput> iterator = result.nonnullBatchFailedFlowsOutput().values().iterator();
+        Assert.assertEquals(2, result.nonnullBatchFailedFlowsOutput().size());
+        Assert.assertEquals(FLOW_ID_VALUE_1, iterator.next().getFlowId().getValue());
+        Assert.assertEquals(FLOW_ID_VALUE_2, iterator.next().getFlowId().getValue());
 
         final InOrder inOrder = Mockito.inOrder(salFlowService, transactionService);
 
@@ -253,14 +256,14 @@ public class SalFlowsBatchServiceImplTest {
                 .build();
 
         final Future<RpcResult<AddFlowsBatchOutput>> resultFuture = salFlowsBatchService.addFlowsBatch(input);
+        Iterator<BatchFailedFlowsOutput> iterator = resultFuture.get().getResult().nonnullBatchFailedFlowsOutput()
+                .values().iterator();
 
         Assert.assertTrue(resultFuture.isDone());
         Assert.assertFalse(resultFuture.get().isSuccessful());
-        Assert.assertEquals(2, resultFuture.get().getResult().getBatchFailedFlowsOutput().size());
-        Assert.assertEquals(FLOW_ID_VALUE_1,
-                resultFuture.get().getResult().getBatchFailedFlowsOutput().get(0).getFlowId().getValue());
-        Assert.assertEquals(FLOW_ID_VALUE_2,
-                resultFuture.get().getResult().getBatchFailedFlowsOutput().get(1).getFlowId().getValue());
+        Assert.assertEquals(2, resultFuture.get().getResult().nonnullBatchFailedFlowsOutput().size());
+        Assert.assertEquals(FLOW_ID_VALUE_1, iterator.next().getFlowId().getValue());
+        Assert.assertEquals(FLOW_ID_VALUE_2, iterator.next().getFlowId().getValue());
         Assert.assertEquals(2, resultFuture.get().getErrors().size());
 
         final InOrder inOrder = Mockito.inOrder(salFlowService, transactionService);
@@ -321,15 +324,15 @@ public class SalFlowsBatchServiceImplTest {
                 .build();
 
         final Future<RpcResult<UpdateFlowsBatchOutput>> resultFuture = salFlowsBatchService.updateFlowsBatch(input);
+        Iterator<BatchFailedFlowsOutput> iterator = resultFuture.get().getResult().nonnullBatchFailedFlowsOutput()
+                .values().iterator();
 
         Assert.assertTrue(resultFuture.isDone());
         Assert.assertFalse(resultFuture.get().isSuccessful());
         Assert.assertFalse(resultFuture.get().isSuccessful());
-        Assert.assertEquals(2, resultFuture.get().getResult().getBatchFailedFlowsOutput().size());
-        Assert.assertEquals(FLOW_ID_VALUE_1,
-                resultFuture.get().getResult().getBatchFailedFlowsOutput().get(0).getFlowId().getValue());
-        Assert.assertEquals(FLOW_ID_VALUE_2,
-                resultFuture.get().getResult().getBatchFailedFlowsOutput().get(1).getFlowId().getValue());
+        Assert.assertEquals(2, resultFuture.get().getResult().nonnullBatchFailedFlowsOutput().size());
+        Assert.assertEquals(FLOW_ID_VALUE_1, iterator.next().getFlowId().getValue());
+        Assert.assertEquals(FLOW_ID_VALUE_2, iterator.next().getFlowId().getValue());
         Assert.assertEquals(2, resultFuture.get().getErrors().size());
 
         final InOrder inOrder = Mockito.inOrder(salFlowService, transactionService);
index ec0576f9d48019b5c7edf79336bddf4b96e16628..ba70b4951524316e685fdfb7af14b705f45ab3ab 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.openflowplugin.impl.services.sal;
 
 import com.google.common.collect.Lists;
+import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.Future;
 import org.junit.After;
@@ -49,6 +50,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.ad
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.add.groups.batch.input.BatchAddGroupsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.batch.group.input.update.grouping.OriginalBatchedGroupBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.batch.group.input.update.grouping.UpdatedBatchedGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.batch.group.output.list.grouping.BatchFailedGroupsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.remove.groups.batch.input.BatchRemoveGroups;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.remove.groups.batch.input.BatchRemoveGroupsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.groups.service.rev160315.update.groups.batch.input.BatchUpdateGroups;
@@ -147,14 +149,14 @@ public class SalGroupsBatchServiceImplTest {
                 .build();
 
         final Future<RpcResult<UpdateGroupsBatchOutput>> resultFuture = salGroupsBatchService.updateGroupsBatch(input);
+        Iterator<BatchFailedGroupsOutput> iterator = resultFuture.get().getResult().nonnullBatchFailedGroupsOutput()
+                .values().iterator();
 
         Assert.assertTrue(resultFuture.isDone());
         Assert.assertFalse(resultFuture.get().isSuccessful());
-        Assert.assertEquals(2, resultFuture.get().getResult().getBatchFailedGroupsOutput().size());
-        Assert.assertEquals(43L,
-                resultFuture.get().getResult().getBatchFailedGroupsOutput().get(0).getGroupId().getValue().longValue());
-        Assert.assertEquals(45L,
-                resultFuture.get().getResult().getBatchFailedGroupsOutput().get(1).getGroupId().getValue().longValue());
+        Assert.assertEquals(2, resultFuture.get().getResult().nonnullBatchFailedGroupsOutput().size());
+        Assert.assertEquals(43L, iterator.next().getGroupId().getValue().longValue());
+        Assert.assertEquals(45L, iterator.next().getGroupId().getValue().longValue());
         Assert.assertEquals(2, resultFuture.get().getErrors().size());
 
 
@@ -215,14 +217,14 @@ public class SalGroupsBatchServiceImplTest {
                 .build();
 
         final Future<RpcResult<AddGroupsBatchOutput>> resultFuture = salGroupsBatchService.addGroupsBatch(input);
+        Iterator<BatchFailedGroupsOutput> iterator = resultFuture.get().getResult().nonnullBatchFailedGroupsOutput()
+                .values().iterator();
 
         Assert.assertTrue(resultFuture.isDone());
         Assert.assertFalse(resultFuture.get().isSuccessful());
-        Assert.assertEquals(2, resultFuture.get().getResult().getBatchFailedGroupsOutput().size());
-        Assert.assertEquals(42L,
-                resultFuture.get().getResult().getBatchFailedGroupsOutput().get(0).getGroupId().getValue().longValue());
-        Assert.assertEquals(43L,
-                resultFuture.get().getResult().getBatchFailedGroupsOutput().get(1).getGroupId().getValue().longValue());
+        Assert.assertEquals(2, resultFuture.get().getResult().nonnullBatchFailedGroupsOutput().size());
+        Assert.assertEquals(42L, iterator.next().getGroupId().getValue().longValue());
+        Assert.assertEquals(43L, iterator.next().getGroupId().getValue().longValue());
         Assert.assertEquals(2, resultFuture.get().getErrors().size());
 
 
@@ -281,14 +283,14 @@ public class SalGroupsBatchServiceImplTest {
                 .build();
 
         final Future<RpcResult<RemoveGroupsBatchOutput>> resultFuture = salGroupsBatchService.removeGroupsBatch(input);
+        Iterator<BatchFailedGroupsOutput> iterator = resultFuture.get().getResult().nonnullBatchFailedGroupsOutput()
+                .values().iterator();
 
         Assert.assertTrue(resultFuture.isDone());
         Assert.assertFalse(resultFuture.get().isSuccessful());
-        Assert.assertEquals(2, resultFuture.get().getResult().getBatchFailedGroupsOutput().size());
-        Assert.assertEquals(42L,
-                resultFuture.get().getResult().getBatchFailedGroupsOutput().get(0).getGroupId().getValue().longValue());
-        Assert.assertEquals(43L,
-                resultFuture.get().getResult().getBatchFailedGroupsOutput().get(1).getGroupId().getValue().longValue());
+        Assert.assertEquals(2, resultFuture.get().getResult().nonnullBatchFailedGroupsOutput().size());
+        Assert.assertEquals(42L, iterator.next().getGroupId().getValue().longValue());
+        Assert.assertEquals(43L, iterator.next().getGroupId().getValue().longValue());
         Assert.assertEquals(2, resultFuture.get().getErrors().size());
 
         final InOrder inOrder = Mockito.inOrder(salGroupService, transactionService);
index f5343fd5bc361d7df273e079de583931479511c3..e19e022e5a2b85106585c65e0226b0da23988b66 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.impl.services.sal;
 import static org.mockito.ArgumentMatchers.any;
 
 import com.google.common.collect.Lists;
+import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.Future;
 import org.junit.After;
@@ -56,6 +57,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.ad
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.add.meters.batch.input.BatchAddMetersBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.input.update.grouping.OriginalBatchedMeterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.input.update.grouping.UpdatedBatchedMeterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.output.list.grouping.BatchFailedMetersOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.remove.meters.batch.input.BatchRemoveMeters;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.remove.meters.batch.input.BatchRemoveMetersBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.update.meters.batch.input.BatchUpdateMeters;
@@ -148,14 +150,14 @@ public class SalMetersBatchServiceImplTest {
                 .build();
 
         final Future<RpcResult<UpdateMetersBatchOutput>> resultFuture = salMetersBatchService.updateMetersBatch(input);
+        Iterator<BatchFailedMetersOutput> iterator = resultFuture.get().getResult().nonnullBatchFailedMetersOutput()
+                .values().iterator();
 
         Assert.assertTrue(resultFuture.isDone());
         Assert.assertFalse(resultFuture.get().isSuccessful());
-        Assert.assertEquals(2, resultFuture.get().getResult().getBatchFailedMetersOutput().size());
-        Assert.assertEquals(43L,
-                resultFuture.get().getResult().getBatchFailedMetersOutput().get(0).getMeterId().getValue().longValue());
-        Assert.assertEquals(45L,
-                resultFuture.get().getResult().getBatchFailedMetersOutput().get(1).getMeterId().getValue().longValue());
+        Assert.assertEquals(2, resultFuture.get().getResult().nonnullBatchFailedMetersOutput().size());
+        Assert.assertEquals(43L, iterator.next().getMeterId().getValue().longValue());
+        Assert.assertEquals(45L,iterator.next().getMeterId().getValue().longValue());
         Assert.assertEquals(2, resultFuture.get().getErrors().size());
 
 
@@ -216,14 +218,14 @@ public class SalMetersBatchServiceImplTest {
                 .build();
 
         final Future<RpcResult<AddMetersBatchOutput>> resultFuture = salMetersBatchService.addMetersBatch(input);
+        Iterator<BatchFailedMetersOutput> iterator = resultFuture.get().getResult().nonnullBatchFailedMetersOutput()
+                .values().iterator();
 
         Assert.assertTrue(resultFuture.isDone());
         Assert.assertFalse(resultFuture.get().isSuccessful());
-        Assert.assertEquals(2, resultFuture.get().getResult().getBatchFailedMetersOutput().size());
-        Assert.assertEquals(42L,
-                resultFuture.get().getResult().getBatchFailedMetersOutput().get(0).getMeterId().getValue().longValue());
-        Assert.assertEquals(43L,
-                resultFuture.get().getResult().getBatchFailedMetersOutput().get(1).getMeterId().getValue().longValue());
+        Assert.assertEquals(2, resultFuture.get().getResult().nonnullBatchFailedMetersOutput().size());
+        Assert.assertEquals(42L, iterator.next().getMeterId().getValue().longValue());
+        Assert.assertEquals(43L,iterator.next().getMeterId().getValue().longValue());
         Assert.assertEquals(2, resultFuture.get().getErrors().size());
 
 
@@ -282,14 +284,14 @@ public class SalMetersBatchServiceImplTest {
                 .build();
 
         final Future<RpcResult<RemoveMetersBatchOutput>> resultFuture = salMetersBatchService.removeMetersBatch(input);
+        Iterator<BatchFailedMetersOutput> iterator = resultFuture.get().getResult().nonnullBatchFailedMetersOutput()
+                .values().iterator();
 
         Assert.assertTrue(resultFuture.isDone());
         Assert.assertFalse(resultFuture.get().isSuccessful());
-        Assert.assertEquals(2, resultFuture.get().getResult().getBatchFailedMetersOutput().size());
-        Assert.assertEquals(42L,
-                resultFuture.get().getResult().getBatchFailedMetersOutput().get(0).getMeterId().getValue().longValue());
-        Assert.assertEquals(43L,
-                resultFuture.get().getResult().getBatchFailedMetersOutput().get(1).getMeterId().getValue().longValue());
+        Assert.assertEquals(2, resultFuture.get().getResult().nonnullBatchFailedMetersOutput().size());
+        Assert.assertEquals(42L, iterator.next().getMeterId().getValue().longValue());
+        Assert.assertEquals(43L, iterator.next().getMeterId().getValue().longValue());
         Assert.assertEquals(2, resultFuture.get().getErrors().size());
 
         final InOrder inOrder = Mockito.inOrder(salMeterService, transactionService);
index 624c6b44b62a3b53581a1471c1791986ac458b00..50005bd3346600dc7523c3c730a6f090ac4906c4 100644 (file)
@@ -55,7 +55,7 @@ public class SingleLayerTableMultipartServiceTest extends ServiceMocking {
         final MultipartRequestTableFeatures result = (MultipartRequestTableFeatures) ((MultipartRequest) ofHeader)
             .getMultipartRequestBody();
 
-        assertEquals(MAX_ENTRIES, result.getTableFeatures().get(0).getMaxEntries().longValue());
+        assertEquals(MAX_ENTRIES, result.nonnullTableFeatures().values().iterator().next().getMaxEntries().longValue());
     }
 
     @Test
index 482cc611728f5cb8a6f5a70f3331c55e7b2fc6b0..59a6b272ea7164ebf344981c682ad3c69d2f267f 100644 (file)
@@ -14,7 +14,7 @@ import static org.mockito.Mockito.when;
 
 import com.google.common.collect.Lists;
 import java.util.Collections;
-import java.util.List;
+import java.util.Map;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.openflowplugin.api.OFConstants;
@@ -29,6 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupStatisticsReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStatsKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.AggregateFlowStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupType;
@@ -145,11 +146,11 @@ public class MultipartReplyTranslatorTest {
         org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsAndPortNumberMap
                 nodeConnectorStatisticsUpdate = (org.opendaylight.yang.gen.v1.urn
                 .opendaylight.port.statistics.rev131214.NodeConnectorStatisticsAndPortNumberMap) dataObject;
-        List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatisticsAndPortNumberMaps =
-                nodeConnectorStatisticsUpdate.getNodeConnectorStatisticsAndPortNumberMap();
+        var nodeConnectorStatisticsAndPortNumberMaps =
+                nodeConnectorStatisticsUpdate.nonnullNodeConnectorStatisticsAndPortNumberMap();
         assertEquals(1, nodeConnectorStatisticsAndPortNumberMaps.size());
         NodeConnectorStatisticsAndPortNumberMap nodeConnectorStatisticsAndPortNumberMap =
-                nodeConnectorStatisticsAndPortNumberMaps.get(0);
+                nodeConnectorStatisticsAndPortNumberMaps.values().iterator().next();
         assertEquals("openflow:" + DUMMY_DATAPATH_ID + ":" + DUMMY_PORT_NO,
                 nodeConnectorStatisticsAndPortNumberMap.getNodeConnectorId().getValue());
         assertEquals(DUMMY_RX_BYTES, nodeConnectorStatisticsAndPortNumberMap.getBytes().getReceived());
@@ -182,12 +183,9 @@ public class MultipartReplyTranslatorTest {
         DataContainer dataObject = validateOutput(result);
         assertTrue(dataObject instanceof GroupStatisticsReply);
         GroupStatisticsReply groupStatisticsUpdate = (GroupStatisticsReply)dataObject;
-        List<org.opendaylight.yang.gen.v1.urn
-                .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats> groupStats =
-                groupStatisticsUpdate.getGroupStats();
+        var groupStats = groupStatisticsUpdate.nonnullGroupStats();
         assertEquals(1, groupStats.size());
-        org.opendaylight.yang.gen.v1.urn
-                .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats groupStat = groupStats.get(0);
+        var groupStat = groupStats.values().iterator().next();
 
         assertEquals(DUMMY_BYTE_COUNT, groupStat.getByteCount().getValue());
         assertEquals(DUMMY_DURATION_SEC, groupStat.getDuration().getSecond().getValue());
@@ -213,9 +211,9 @@ public class MultipartReplyTranslatorTest {
         DataContainer dataObject = validateOutput(result);
         assertTrue(dataObject instanceof GroupDescStatsReply);
         GroupDescStatsReply groupStatistics = (GroupDescStatsReply) dataObject;
-        List<GroupDescStats> groupDescStats = groupStatistics.getGroupDescStats();
+        Map<GroupDescStatsKey, GroupDescStats> groupDescStats = groupStatistics.nonnullGroupDescStats();
         assertEquals(1, groupDescStats.size());
-        GroupDescStats groupDescStat = groupDescStats.get(0);
+        GroupDescStats groupDescStat = groupDescStats.values().iterator().next();
         assertEquals(DUMMY_GROUP_ID.getValue(),groupDescStat.getGroupId().getValue());
         assertEquals(DUMMY_GROUPS_TYPE,groupDescStat.getGroupType());
     }
index a0798eeb485ccbb5fa2ba411aa8a13726ac1cb6e..cf941cb1bd006501120f828c916aa601f588284b 100644 (file)
@@ -18,6 +18,7 @@ import static org.mockito.Mockito.when;
 import java.math.BigInteger;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.api.openflow.registry.flow.DeviceFlowRegistry;
@@ -28,6 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowAndStatisticsMap;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
@@ -98,9 +100,9 @@ public class FlowDirectStatisticsServiceTest extends AbstractDirectStatisticsSer
         when(reply.getMultipartReplyBody()).thenReturn(flowCase);
 
         final GetFlowStatisticsOutput output = service.buildReply(input, true);
-        assertTrue(output.getFlowAndStatisticsMapList().size() > 0);
+        assertTrue(output.nonnullFlowAndStatisticsMapList().size() > 0);
 
-        final FlowAndStatisticsMap stats = output.getFlowAndStatisticsMapList().get(0);
+        final FlowAndStatisticsMap stats = output.nonnullFlowAndStatisticsMapList().values().iterator().next();
 
         assertEquals(stats.getTableId(), TABLE_NO);
     }
@@ -111,9 +113,10 @@ public class FlowDirectStatisticsServiceTest extends AbstractDirectStatisticsSer
         when(stat.getTableId()).thenReturn(TABLE_NO);
         when(stat.getMatch()).thenReturn(new MatchBuilder().build());
 
-        final List<FlowAndStatisticsMapList> stats = Collections.singletonList(stat);
+        final Map<FlowAndStatisticsMapListKey, FlowAndStatisticsMapList> stats
+                = Collections.singletonMap(stat.key(), stat);
         final GetFlowStatisticsOutput output = mock(GetFlowStatisticsOutput.class);
-        when(output.getFlowAndStatisticsMapList()).thenReturn(stats);
+        when(output.nonnullFlowAndStatisticsMapList()).thenReturn(stats);
 
         multipartWriterProvider.lookup(MultipartType.OFPMPFLOW).get().write(output, true);
         verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
index 204d1a2a2cec22c14b21bf40ecf37e1a3afc64dc..bfab2a3667d2c7c57b6c65d73b8ebf4f106b274c 100644 (file)
@@ -91,24 +91,19 @@ public class GroupDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
         assertTrue(output.getGroupStats().size() > 0);
 
         final org.opendaylight.yang.gen.v1.urn
-            .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats stats = output.getGroupStats().get(0);
+            .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats stats =
+                output.nonnullGroupStats().values().iterator().next();
 
         assertEquals(stats.getGroupId().getValue(), GROUP_NO);
     }
 
     @Override
     public void testStoreStatistics() {
-        final org.opendaylight.yang.gen.v1.urn
-                .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats stat =
-                mock(org.opendaylight.yang.gen.v1.urn
-                        .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats.class);
-        when(stat.getGroupId()).thenReturn(new GroupId(GROUP_NO));
-
-        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply
-                .GroupStats>
-                stats = Collections.singletonList(stat);
+        final var stat = new org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply
+                .GroupStatsBuilder().setGroupId(new GroupId(GROUP_NO)).build();
+
         final GetGroupStatisticsOutput output = mock(GetGroupStatisticsOutput.class);
-        when(output.getGroupStats()).thenReturn(stats);
+        when(output.nonnullGroupStats()).thenReturn(Collections.singletonMap(stat.key(), stat));
 
         multipartWriterProvider.lookup(MultipartType.OFPMPGROUP).get().write(output, true);
         verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
index 6b323f3a21538399d387beed087037fb98b6ce5e..b793bdfe7f4cbf189874d3d8ae335e41faa5f828 100644 (file)
@@ -18,12 +18,14 @@ import static org.mockito.Mockito.when;
 import java.math.BigInteger;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractDirectStatisticsServiceTest;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStatsKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
@@ -77,10 +79,10 @@ public class MeterDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
         when(reply.getMultipartReplyBody()).thenReturn(MeterCase);
 
         final GetMeterStatisticsOutput output = service.buildReply(input, true);
-        assertTrue(output.getMeterStats().size() > 0);
+        assertTrue(output.nonnullMeterStats().size() > 0);
 
         final org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats
-                stats = output.getMeterStats().get(0);
+                stats = output.nonnullMeterStats().values().iterator().next();
 
         assertEquals(stats.getMeterId().getValue(), METER_NO);
     }
@@ -91,13 +93,14 @@ public class MeterDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
                 = mock(
                 org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats
                         .class);
+        when(stat.key()).thenReturn(new MeterStatsKey(new MeterId(METER_NO)));
         when(stat.getMeterId()).thenReturn(new MeterId(METER_NO));
 
-        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply
-                .MeterStats>
-                stats = Collections.singletonList(stat);
+        final Map<MeterStatsKey,
+                org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats>
+                stats = Collections.singletonMap(stat.key(), stat);
         final GetMeterStatisticsOutput output = mock(GetMeterStatisticsOutput.class);
-        when(output.getMeterStats()).thenReturn(stats);
+        when(output.nonnullMeterStats()).thenReturn(stats);
 
         multipartWriterProvider.lookup(MultipartType.OFPMPMETER).get().write(output, true);
         verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
index e702635e74ec1f5eb079bb3d8e4dec0979fed635..2f3a5c2bdbcc641664d1ae4fe45269d20988a22d 100644 (file)
@@ -18,6 +18,7 @@ import static org.mockito.Mockito.when;
 
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractDirectStatisticsServiceTest;
@@ -32,6 +33,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapKey;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint64;
 
@@ -92,7 +94,7 @@ public class NodeConnectorDirectStatisticsServiceTest extends AbstractDirectStat
         assertTrue(output.getNodeConnectorStatisticsAndPortNumberMap().size() > 0);
 
         final NodeConnectorStatisticsAndPortNumberMap stats =
-                output.getNodeConnectorStatisticsAndPortNumberMap().get(0);
+                output.nonnullNodeConnectorStatisticsAndPortNumberMap().values().iterator().next();
 
         assertEquals(stats.getNodeConnectorId(), nodeConnectorId);
     }
@@ -100,11 +102,13 @@ public class NodeConnectorDirectStatisticsServiceTest extends AbstractDirectStat
     @Override
     public void testStoreStatistics() {
         final NodeConnectorStatisticsAndPortNumberMap stat = mock(NodeConnectorStatisticsAndPortNumberMap.class);
+        when(stat.key()).thenReturn(new NodeConnectorStatisticsAndPortNumberMapKey(nodeConnectorId));
         when(stat.getNodeConnectorId()).thenReturn(nodeConnectorId);
 
-        final List<NodeConnectorStatisticsAndPortNumberMap> stats = Collections.singletonList(stat);
+        final Map<NodeConnectorStatisticsAndPortNumberMapKey, NodeConnectorStatisticsAndPortNumberMap> stats
+                = Collections.singletonMap(stat.key(), stat);
         final GetNodeConnectorStatisticsOutput output = mock(GetNodeConnectorStatisticsOutput.class);
-        when(output.getNodeConnectorStatisticsAndPortNumberMap()).thenReturn(stats);
+        when(output.nonnullNodeConnectorStatisticsAndPortNumberMap()).thenReturn(stats);
 
         multipartWriterProvider.lookup(MultipartType.OFPMPPORTSTATS).get().write(output, true);
         verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
index 3af233d84eda9bb5c4748890e9100354861a1dec..5427613e2dccfbeb3f9ddbf4f565ae9b7c8d3bf1 100644 (file)
@@ -18,6 +18,7 @@ import static org.mockito.Mockito.when;
 
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import org.junit.Test;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
@@ -35,6 +36,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueue;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapKey;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint64;
 
@@ -90,9 +92,9 @@ public class QueueDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
         when(queueStat.getDurationNsec()).thenReturn(Uint32.ZERO);
 
         final GetQueueStatisticsOutput output = service.buildReply(input, true);
-        assertTrue(output.getQueueIdAndStatisticsMap().size() > 0);
+        assertTrue(output.nonnullQueueIdAndStatisticsMap().size() > 0);
 
-        final QueueIdAndStatisticsMap map = output.getQueueIdAndStatisticsMap().get(0);
+        final QueueIdAndStatisticsMap map = output.nonnullQueueIdAndStatisticsMap().values().iterator().next();
         assertEquals(map.getQueueId().getValue(), QUEUE_NO);
         assertEquals(map.getNodeConnectorId(), nodeConnectorId);
     }
@@ -102,10 +104,12 @@ public class QueueDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
         final QueueIdAndStatisticsMap map = mock(QueueIdAndStatisticsMap.class);
         when(map.getQueueId()).thenReturn(new QueueId(QUEUE_NO));
         when(map.getNodeConnectorId()).thenReturn(new NodeConnectorId("1"));
+        when(map.key()).thenReturn(new QueueIdAndStatisticsMapKey(new NodeConnectorId("1"), new QueueId(QUEUE_NO)));
 
-        final List<QueueIdAndStatisticsMap> maps = Collections.singletonList(map);
+        final Map<QueueIdAndStatisticsMapKey, QueueIdAndStatisticsMap> maps
+                = Collections.singletonMap(map.key(), map);
         final GetQueueStatisticsOutput output = mock(GetQueueStatisticsOutput.class);
-        when(output.getQueueIdAndStatisticsMap()).thenReturn(maps);
+        when(output.nonnullQueueIdAndStatisticsMap()).thenReturn(maps);
 
         multipartWriterProvider.lookup(MultipartType.OFPMPQUEUE).get().write(output, true);
         verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
@@ -116,10 +120,13 @@ public class QueueDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
         final QueueIdAndStatisticsMap map = mock(QueueIdAndStatisticsMap.class);
         when(map.getQueueId()).thenReturn(new QueueId(QUEUE_NO));
         when(map.getNodeConnectorId()).thenReturn(new NodeConnectorId("openflow:1:1"));
+        when(map.key()).thenReturn(new QueueIdAndStatisticsMapKey(new NodeConnectorId("openflow:1:1"),
+            new QueueId(QUEUE_NO)));
 
-        final List<QueueIdAndStatisticsMap> maps = Collections.singletonList(map);
+        final Map<QueueIdAndStatisticsMapKey, QueueIdAndStatisticsMap> maps
+                = Collections.singletonMap(map.key(), map);
         final GetQueueStatisticsOutput output = mock(GetQueueStatisticsOutput.class);
-        when(output.getQueueIdAndStatisticsMap()).thenReturn(maps);
+        when(output.nonnullQueueIdAndStatisticsMap()).thenReturn(maps);
 
         multipartWriterProvider.lookup(MultipartType.OFPMPQUEUE).get().write(output, true);
         verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
index 23ab51a41dab661c7edf839e3e6a61f7c1ed4e30..06753337c0be2595d890dc34be52cade910a4049 100644 (file)
@@ -18,6 +18,7 @@ import static org.mockito.Mockito.when;
 import java.math.BigInteger;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.api.openflow.registry.flow.DeviceFlowRegistry;
@@ -31,6 +32,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.Fl
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowAndStatisticsMap;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowStatsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -96,7 +98,7 @@ public class FlowDirectStatisticsServiceTest extends AbstractDirectStatisticsSer
         final GetFlowStatisticsOutput output = service.buildReply(input, true);
         assertTrue(output.getFlowAndStatisticsMapList().size() > 0);
 
-        final FlowAndStatisticsMap stats = output.getFlowAndStatisticsMapList().get(0);
+        final FlowAndStatisticsMap stats = output.nonnullFlowAndStatisticsMapList().values().iterator().next();
 
         assertEquals(stats.getTableId(), TABLE_NO);
     }
@@ -107,9 +109,10 @@ public class FlowDirectStatisticsServiceTest extends AbstractDirectStatisticsSer
         when(stat.getTableId()).thenReturn(TABLE_NO);
         when(stat.getMatch()).thenReturn(new MatchBuilder().build());
 
-        final List<FlowAndStatisticsMapList> stats = Collections.singletonList(stat);
+        final Map<FlowAndStatisticsMapListKey, FlowAndStatisticsMapList> stats
+                = Collections.singletonMap(stat.key(), stat);
         final GetFlowStatisticsOutput output = mock(GetFlowStatisticsOutput.class);
-        when(output.getFlowAndStatisticsMapList()).thenReturn(stats);
+        when(output.nonnullFlowAndStatisticsMapList()).thenReturn(stats);
 
         multipartWriterProvider.lookup(MultipartType.OFPMPFLOW).get().write(output, true);
         verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
index dce3d3ea5e92ef380ce29ba2469ed5e88192958b..5087f4b09a4e398ffd5dd15772820113176c26cd 100644 (file)
@@ -18,6 +18,7 @@ import static org.mockito.Mockito.when;
 
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractDirectStatisticsServiceTest;
@@ -28,6 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStatsKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReplyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequest;
@@ -75,10 +77,11 @@ public class GroupDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
         final List<MultipartReply> input = Collections.singletonList(reply);
 
         final GetGroupStatisticsOutput output = service.buildReply(input, true);
-        assertTrue(output.getGroupStats().size() > 0);
+        assertTrue(output.nonnullGroupStats().size() > 0);
 
         final org.opendaylight.yang.gen.v1.urn
-            .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats stats = output.getGroupStats().get(0);
+            .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats stats =
+                output.nonnullGroupStats().values().iterator().next();
 
         assertEquals(stats.getGroupId().getValue(), GROUP_NO);
     }
@@ -91,11 +94,9 @@ public class GroupDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
                         .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats.class);
         when(stat.getGroupId()).thenReturn(new GroupId(GROUP_NO));
 
-        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply
-                .GroupStats>
-                stats = Collections.singletonList(stat);
+        final Map<GroupStatsKey, GroupStats> stats = Collections.singletonMap(stat.key(), stat);
         final GetGroupStatisticsOutput output = mock(GetGroupStatisticsOutput.class);
-        when(output.getGroupStats()).thenReturn(stats);
+        when(output.nonnullGroupStats()).thenReturn(stats);
 
         multipartWriterProvider.lookup(MultipartType.OFPMPGROUP).get().write(output, true);
         verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
index d61b1cf11828b563d7c52907b79ce625e23eb1ea..4af0163a391cf8f519e9b27828df2a61db57b756 100644 (file)
@@ -19,6 +19,7 @@ import static org.mockito.Mockito.when;
 import java.math.BigInteger;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractDirectStatisticsServiceTest;
@@ -33,6 +34,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.MeterBandStatsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStatsKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReplyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequest;
@@ -88,9 +90,9 @@ public class MeterDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
         final List<MultipartReply> input = Collections.singletonList(reply);
 
         final GetMeterStatisticsOutput output = service.buildReply(input, true);
-        assertTrue(output.getMeterStats().size() > 0);
+        assertTrue(output.nonnullMeterStats().size() > 0);
 
-        final MeterStats stats = output.getMeterStats().get(0);
+        final MeterStats stats = output.nonnullMeterStats().values().iterator().next();
         assertEquals(stats.getMeterId().getValue(), METER_NO);
     }
 
@@ -102,11 +104,11 @@ public class MeterDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
                         .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats.class);
         when(stat.getMeterId()).thenReturn(new MeterId(METER_NO));
 
-        final List<org.opendaylight.yang.gen.v1.urn
+        final Map<MeterStatsKey, org.opendaylight.yang.gen.v1.urn
                 .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats>
-                stats = Collections.singletonList(stat);
+                stats = Collections.singletonMap(stat.key(), stat);
         final GetMeterStatisticsOutput output = mock(GetMeterStatisticsOutput.class);
-        when(output.getMeterStats()).thenReturn(stats);
+        when(output.nonnullMeterStats()).thenReturn(stats);
 
         multipartWriterProvider.lookup(MultipartType.OFPMPMETER).get().write(output, true);
         verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
index 932f6598986a06d3f8fa6819219f41bc4bed43d7..53e1986ea8ed9296f6959e34e472a0ac6ae6df71 100644 (file)
@@ -18,6 +18,7 @@ import static org.mockito.Mockito.when;
 
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractDirectStatisticsServiceTest;
@@ -31,6 +32,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.m
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.multipart.request.multipart.request.body.MultipartRequestPortStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapKey;
 import org.opendaylight.yangtools.yang.common.Uint32;
 
 public class NodeConnectorDirectStatisticsServiceTest extends AbstractDirectStatisticsServiceTest {
@@ -72,10 +74,10 @@ public class NodeConnectorDirectStatisticsServiceTest extends AbstractDirectStat
 
         final List<MultipartReply> input = Collections.singletonList(reply);
         final GetNodeConnectorStatisticsOutput output = service.buildReply(input, true);
-        assertTrue(output.getNodeConnectorStatisticsAndPortNumberMap().size() > 0);
+        assertTrue(output.nonnullNodeConnectorStatisticsAndPortNumberMap().size() > 0);
 
         final NodeConnectorStatisticsAndPortNumberMap stats =
-                output.getNodeConnectorStatisticsAndPortNumberMap().get(0);
+                output.nonnullNodeConnectorStatisticsAndPortNumberMap().values().iterator().next();
 
         assertEquals(stats.getNodeConnectorId(), nodeConnectorId);
     }
@@ -85,9 +87,10 @@ public class NodeConnectorDirectStatisticsServiceTest extends AbstractDirectStat
         final NodeConnectorStatisticsAndPortNumberMap stat = mock(NodeConnectorStatisticsAndPortNumberMap.class);
         when(stat.getNodeConnectorId()).thenReturn(nodeConnectorId);
 
-        final List<NodeConnectorStatisticsAndPortNumberMap> stats = Collections.singletonList(stat);
+        final Map<NodeConnectorStatisticsAndPortNumberMapKey, NodeConnectorStatisticsAndPortNumberMap> stats
+                = Collections.singletonMap(stat.key(), stat);
         final GetNodeConnectorStatisticsOutput output = mock(GetNodeConnectorStatisticsOutput.class);
-        when(output.getNodeConnectorStatisticsAndPortNumberMap()).thenReturn(stats);
+        when(output.nonnullNodeConnectorStatisticsAndPortNumberMap()).thenReturn(stats);
 
         multipartWriterProvider.lookup(MultipartType.OFPMPPORTSTATS).get().write(output, true);
         verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
index bb50e72972727e04b1d31025d8199acfa9bdb609..0ea3df60de3a80a6c25149b44b5f249a98bffe87 100644 (file)
@@ -19,6 +19,7 @@ import static org.mockito.Mockito.when;
 import java.math.BigInteger;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import org.junit.Test;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
@@ -36,6 +37,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.multipart.request.multipart.request.body.MultipartRequestQueueStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMap;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapKey;
 import org.opendaylight.yangtools.yang.common.Uint32;
 
 public class QueueDirectStatisticsServiceTest extends AbstractDirectStatisticsServiceTest {
@@ -84,9 +86,9 @@ public class QueueDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
 
         final List<MultipartReply> input = Collections.singletonList(reply);
         final GetQueueStatisticsOutput output = service.buildReply(input, true);
-        assertTrue(output.getQueueIdAndStatisticsMap().size() > 0);
+        assertTrue(output.nonnullQueueIdAndStatisticsMap().size() > 0);
 
-        final QueueIdAndStatisticsMap map = output.getQueueIdAndStatisticsMap().get(0);
+        final QueueIdAndStatisticsMap map = output.nonnullQueueIdAndStatisticsMap().values().iterator().next();
         assertEquals(map.getQueueId().getValue(), QUEUE_NO);
         assertEquals(map.getNodeConnectorId().getValue(), PORT_NO.toString());
     }
@@ -96,10 +98,12 @@ public class QueueDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
         final QueueIdAndStatisticsMap map = mock(QueueIdAndStatisticsMap.class);
         when(map.getQueueId()).thenReturn(new QueueId(QUEUE_NO));
         when(map.getNodeConnectorId()).thenReturn(new NodeConnectorId("1"));
+        when(map.key()).thenReturn(
+            new QueueIdAndStatisticsMapKey(new NodeConnectorId("1"), new QueueId(QUEUE_NO)));
 
-        final List<QueueIdAndStatisticsMap> maps = Collections.singletonList(map);
         final GetQueueStatisticsOutput output = mock(GetQueueStatisticsOutput.class);
-        when(output.getQueueIdAndStatisticsMap()).thenReturn(maps);
+        Map<QueueIdAndStatisticsMapKey, QueueIdAndStatisticsMap> stats = Collections.singletonMap(map.key(), map);
+        when(output.nonnullQueueIdAndStatisticsMap()).thenReturn(stats);
 
         multipartWriterProvider.lookup(MultipartType.OFPMPQUEUE).get().write(output, true);
         verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
@@ -110,10 +114,12 @@ public class QueueDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
         final QueueIdAndStatisticsMap map = mock(QueueIdAndStatisticsMap.class);
         when(map.getQueueId()).thenReturn(new QueueId(QUEUE_NO));
         when(map.getNodeConnectorId()).thenReturn(new NodeConnectorId("openflow:1:1"));
+        when(map.key()).thenReturn(
+            new QueueIdAndStatisticsMapKey(new NodeConnectorId("openflow:1:1"), new QueueId(QUEUE_NO)));
 
-        final List<QueueIdAndStatisticsMap> maps = Collections.singletonList(map);
+        final Map<QueueIdAndStatisticsMapKey, QueueIdAndStatisticsMap> maps = Collections.singletonMap(map.key(), map);
         final GetQueueStatisticsOutput output = mock(GetQueueStatisticsOutput.class);
-        when(output.getQueueIdAndStatisticsMap()).thenReturn(maps);
+        when(output.nonnullQueueIdAndStatisticsMap()).thenReturn(maps);
 
         multipartWriterProvider.lookup(MultipartType.OFPMPQUEUE).get().write(output, true);
         verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
index 5f687db1983d0f2e2057dc3d42f949987fb57021..46febc66c9baa61b1713ba514c1e648282cf401e 100644 (file)
@@ -5,7 +5,6 @@
  * 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.openflowplugin.impl.translator;
 
 import org.junit.Assert;
@@ -76,10 +75,10 @@ public class PortUpdateTranslatorTest {
         Assert.assertEquals(portFeatures, nodeConnector.getPeerFeatures());
         Assert.assertEquals(portFeatures, nodeConnector.getSupported());
         Assert.assertEquals(portStateBld.build(), nodeConnector.getState());
-        Assert.assertTrue(nodeConnector.getQueue().isEmpty());
+        Assert.assertNull(nodeConnector.getQueue());
     }
 
-    private void commonCheck(FlowCapableNodeConnector nodeConnector) {
+    private static void commonCheck(final FlowCapableNodeConnector nodeConnector) {
         Assert.assertEquals(84L, nodeConnector.getCurrentSpeed().longValue());
         Assert.assertEquals(84L * 2, nodeConnector.getMaximumSpeed().longValue());
         Assert.assertEquals("utPortName:21", nodeConnector.getName());
@@ -110,7 +109,7 @@ public class PortUpdateTranslatorTest {
         Assert.assertNull(nodeConnector.getQueue());
     }
 
-    private PortStatusMessageBuilder assemblePortStatusMessage(long portNoValue, long speed) {
+    private static PortStatusMessageBuilder assemblePortStatusMessage(final long portNoValue, final long speed) {
         final PortFeatures portFeatures13 = PortFeatures.getDefaultInstance("_100gbFd");
         final PortFeaturesV10 portFeatures10 = PortFeaturesV10.getDefaultInstance("_100mbFd");
         final PortConfig portConfig13 = PortConfig.getDefaultInstance("noFwd");
index 545066a0b6775e153426e15c85cdc1811d9f2e53..6c99feb20a2ba96f4049d54801ed902e5828d183 100644 (file)
@@ -30,22 +30,42 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev16032
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchUpdateFlowCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchUpdateGroupCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.FlatBatchUpdateMeterCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.flow._case.FlatBatchAddFlow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.flow._case.FlatBatchAddFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.flow._case.FlatBatchAddFlowKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.group._case.FlatBatchAddGroup;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.group._case.FlatBatchAddGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.group._case.FlatBatchAddGroupKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.meter._case.FlatBatchAddMeter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.meter._case.FlatBatchAddMeterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.meter._case.FlatBatchAddMeterKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.flow._case.FlatBatchRemoveFlow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.flow._case.FlatBatchRemoveFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.flow._case.FlatBatchRemoveFlowKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.group._case.FlatBatchRemoveGroup;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.group._case.FlatBatchRemoveGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.group._case.FlatBatchRemoveGroupKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.meter._case.FlatBatchRemoveMeter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.meter._case.FlatBatchRemoveMeterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.remove.meter._case.FlatBatchRemoveMeterKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.update.flow._case.FlatBatchUpdateFlow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.update.flow._case.FlatBatchUpdateFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.update.flow._case.FlatBatchUpdateFlowKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.update.group._case.FlatBatchUpdateGroup;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.update.group._case.FlatBatchUpdateGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.update.group._case.FlatBatchUpdateGroupKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.update.meter._case.FlatBatchUpdateMeter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.update.meter._case.FlatBatchUpdateMeterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.update.meter._case.FlatBatchUpdateMeterKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.output.BatchFailure;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.output.BatchFailureBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.output.BatchFailureKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.output.batch.failure.batch.item.id.choice.FlatBatchFailureFlowIdCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -206,47 +226,47 @@ public class FlatBatchUtilTest {
         switch (type) {
             case FLOW_ADD:
                 batchCase = new FlatBatchAddFlowCaseBuilder()
-                        .setFlatBatchAddFlow(repeatIntoList(new FlatBatchAddFlowBuilder().build(), size))
+                        .setFlatBatchAddFlow(repeatFlatBatchAddFlowIntoList(size))
                         .build();
                 break;
             case FLOW_REMOVE:
                 batchCase = new FlatBatchRemoveFlowCaseBuilder()
-                        .setFlatBatchRemoveFlow(repeatIntoList(new FlatBatchRemoveFlowBuilder().build(), size))
+                        .setFlatBatchRemoveFlow(repeatFlatBatchRemoveFlowIntoList(size))
                         .build();
                 break;
             case FLOW_UPDATE:
                 batchCase = new FlatBatchUpdateFlowCaseBuilder()
-                        .setFlatBatchUpdateFlow(repeatIntoList(new FlatBatchUpdateFlowBuilder().build(), size))
+                        .setFlatBatchUpdateFlow(repeatFlatBatchUpdateFlowIntoList(size))
                         .build();
                 break;
             case GROUP_ADD:
                 batchCase = new FlatBatchAddGroupCaseBuilder()
-                        .setFlatBatchAddGroup(repeatIntoList(new FlatBatchAddGroupBuilder().build(), size))
+                        .setFlatBatchAddGroup(repeatFlatBatchAddGroupIntoList(size))
                         .build();
                 break;
             case GROUP_REMOVE:
                 batchCase = new FlatBatchRemoveGroupCaseBuilder()
-                        .setFlatBatchRemoveGroup(repeatIntoList(new FlatBatchRemoveGroupBuilder().build(), size))
+                        .setFlatBatchRemoveGroup(repeatFlatBatchRemoveGroupIntoList(size))
                         .build();
                 break;
             case GROUP_UPDATE:
                 batchCase = new FlatBatchUpdateGroupCaseBuilder()
-                        .setFlatBatchUpdateGroup(repeatIntoList(new FlatBatchUpdateGroupBuilder().build(), size))
+                        .setFlatBatchUpdateGroup(repeatFlatBatchUpdateGroupIntoList(size))
                         .build();
                 break;
             case METER_ADD:
                 batchCase = new FlatBatchAddMeterCaseBuilder()
-                        .setFlatBatchAddMeter(repeatIntoList(new FlatBatchAddMeterBuilder().build(), size))
+                        .setFlatBatchAddMeter(repeatFlatBatchAddMeterIntoList(size))
                         .build();
                 break;
             case METER_REMOVE:
                 batchCase = new FlatBatchRemoveMeterCaseBuilder()
-                        .setFlatBatchRemoveMeter(repeatIntoList(new FlatBatchRemoveMeterBuilder().build(), size))
+                        .setFlatBatchRemoveMeter(repeatFlatBatchRemoveMeterIntoList(size))
                         .build();
                 break;
             case METER_UPDATE:
                 batchCase = new FlatBatchUpdateMeterCaseBuilder()
-                        .setFlatBatchUpdateMeter(repeatIntoList(new FlatBatchUpdateMeterBuilder().build(), size))
+                        .setFlatBatchUpdateMeter(repeatFlatBatchUpdateMeterIntoList(size))
                         .build();
                 break;
             default:
@@ -259,10 +279,74 @@ public class FlatBatchUtilTest {
                 .build();
     }
 
-    private <T> List<T> repeatIntoList(final T element, final int size) {
-        final List<T> list = new ArrayList<>();
+    private List<FlatBatchAddGroup> repeatFlatBatchAddGroupIntoList(final int size) {
+        final List<FlatBatchAddGroup> list = new ArrayList<>();
         for (int i = 0; i < size; i++) {
-            list.add(element);
+            list.add(new FlatBatchAddGroupBuilder().withKey(new FlatBatchAddGroupKey(i)).build());
+        }
+        return list;
+    }
+
+    private List<FlatBatchUpdateGroup> repeatFlatBatchUpdateGroupIntoList(final int size) {
+        final List<FlatBatchUpdateGroup> list = new ArrayList<>();
+        for (int i = 0; i < size; i++) {
+            list.add(new FlatBatchUpdateGroupBuilder().withKey(new FlatBatchUpdateGroupKey(i)).build());
+        }
+        return list;
+    }
+
+    private List<FlatBatchRemoveGroup> repeatFlatBatchRemoveGroupIntoList(final int size) {
+        final List<FlatBatchRemoveGroup> list = new ArrayList<>();
+        for (int i = 0; i < size; i++) {
+            list.add(new FlatBatchRemoveGroupBuilder().withKey(new FlatBatchRemoveGroupKey(i)).build());
+        }
+        return list;
+    }
+
+    private List<FlatBatchAddFlow> repeatFlatBatchAddFlowIntoList(final int size) {
+        final List<FlatBatchAddFlow> list = new ArrayList<>();
+        for (int i = 0; i < size; i++) {
+            list.add(new FlatBatchAddFlowBuilder().withKey(new FlatBatchAddFlowKey(i)).build());
+        }
+        return list;
+    }
+
+    private List<FlatBatchUpdateFlow> repeatFlatBatchUpdateFlowIntoList(final int size) {
+        final List<FlatBatchUpdateFlow> list = new ArrayList<>();
+        for (int i = 0; i < size; i++) {
+            list.add(new FlatBatchUpdateFlowBuilder().withKey(new FlatBatchUpdateFlowKey(i)).build());
+        }
+        return list;
+    }
+
+    private List<FlatBatchRemoveFlow> repeatFlatBatchRemoveFlowIntoList(final int size) {
+        final List<FlatBatchRemoveFlow> list = new ArrayList<>();
+        for (int i = 0; i < size; i++) {
+            list.add(new FlatBatchRemoveFlowBuilder().withKey(new FlatBatchRemoveFlowKey(i)).build());
+        }
+        return list;
+    }
+
+    private List<FlatBatchAddMeter> repeatFlatBatchAddMeterIntoList(final int size) {
+        final List<FlatBatchAddMeter> list = new ArrayList<>();
+        for (int i = 0; i < size; i++) {
+            list.add(new FlatBatchAddMeterBuilder().withKey(new FlatBatchAddMeterKey(i)).build());
+        }
+        return list;
+    }
+
+    private List<FlatBatchUpdateMeter> repeatFlatBatchUpdateMeterIntoList(final int size) {
+        final List<FlatBatchUpdateMeter> list = new ArrayList<>();
+        for (int i = 0; i < size; i++) {
+            list.add(new FlatBatchUpdateMeterBuilder().withKey(new FlatBatchUpdateMeterKey(i)).build());
+        }
+        return list;
+    }
+
+    private List<FlatBatchRemoveMeter> repeatFlatBatchRemoveMeterIntoList(final int size) {
+        final List<FlatBatchRemoveMeter> list = new ArrayList<>();
+        for (int i = 0; i < size; i++) {
+            list.add(new FlatBatchRemoveMeterBuilder().withKey(new FlatBatchRemoveMeterKey(i)).build());
         }
         return list;
     }
@@ -274,14 +358,29 @@ public class FlatBatchUtilTest {
                 .setBatchItemIdChoice(new FlatBatchFailureFlowIdCaseBuilder()
                         .setFlowId(new FlowId("11"))
                         .build())
+                .withKey(new BatchFailureKey(Uint16.ZERO))
+                .build();
+        final BatchFailure batchFailure_1 = new BatchFailureBuilder()
+                .setBatchOrder(9)
+                .setBatchItemIdChoice(new FlatBatchFailureFlowIdCaseBuilder()
+                        .setFlowId(new FlowId("11"))
+                        .build())
+                .withKey(new BatchFailureKey(Uint16.ONE))
                 .build();
 
         final ProcessFlatBatchOutput output
                 = new ProcessFlatBatchOutputBuilder().setBatchFailure(Lists.newArrayList(batchFailure)).build();
 
+        final ProcessFlatBatchOutput output_1
+                = new ProcessFlatBatchOutputBuilder().setBatchFailure(Lists.newArrayList(batchFailure_1)).build();
+
         final RpcResult<ProcessFlatBatchOutput> rpcResultFailed = RpcResultBuilder.<ProcessFlatBatchOutput>failed()
                 .withError(RpcError.ErrorType.APPLICATION, "ut-rpcError")
                 .withResult(output).build();
+
+        final RpcResult<ProcessFlatBatchOutput> rpcResultFailed_1 = RpcResultBuilder.<ProcessFlatBatchOutput>failed()
+                .withError(RpcError.ErrorType.APPLICATION, "ut-rpcError")
+                .withResult(output_1).build();
         final RpcResult<ProcessFlatBatchOutput> rpcResultSuccess = RpcResultBuilder.<ProcessFlatBatchOutput>success()
                 .withResult(new ProcessFlatBatchOutputBuilder().setBatchFailure(new ArrayList<>())).build();
 
@@ -291,7 +390,7 @@ public class FlatBatchUtilTest {
         Assert.assertFalse(rpcResult1.isSuccessful());
 
         final RpcResult<ProcessFlatBatchOutput> rpcResult2
-                = FlatBatchUtil.mergeRpcResults().apply(Lists.newArrayList(rpcResultFailed, rpcResultFailed));
+                = FlatBatchUtil.mergeRpcResults().apply(Lists.newArrayList(rpcResultFailed, rpcResultFailed_1));
         Assert.assertEquals(2, rpcResult2.getErrors().size());
         Assert.assertFalse(rpcResult2.isSuccessful());
 
index 244a1142c34d360ef06dc53994d33cd34c4a610c..83b16538337ef4571579086aeae7977ef7550d20 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.impl.util;
 import com.google.common.collect.Lists;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.function.Function;
 import org.apache.commons.lang3.tuple.Pair;
 import org.junit.Assert;
@@ -27,6 +28,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.Bat
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.BatchFlowOutputListGrouping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.batch.flow.output.list.grouping.BatchFailedFlowsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.batch.flow.output.list.grouping.BatchFailedFlowsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flows.service.rev160314.batch.flow.output.list.grouping.BatchFailedFlowsOutputKey;
 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;
@@ -120,17 +122,19 @@ public class FlowUtilTest {
     private <T extends BatchFlowOutputListGrouping> void checkBatchSuccessOutcomeTransformation(
             final RpcResult<T> output) {
         Assert.assertTrue(output.isSuccessful());
-        Assert.assertEquals(0, output.getResult().getBatchFailedFlowsOutput().size());
+        Map<BatchFailedFlowsOutputKey, BatchFailedFlowsOutput> failedFlows
+                = output.getResult().nonnullBatchFailedFlowsOutput();
+        Assert.assertEquals(0, failedFlows.size());
         Assert.assertEquals(0, output.getErrors().size());
     }
 
-    private RpcResult<List<BatchFailedFlowsOutput>> createEmptyBatchOutcome() {
+    private static RpcResult<List<BatchFailedFlowsOutput>> createEmptyBatchOutcome() {
         return RpcResultBuilder
                 .success(Collections.<BatchFailedFlowsOutput>emptyList())
                 .build();
     }
 
-    private RpcResult<List<BatchFailedFlowsOutput>> createBatchOutcomeWithError() {
+    private static RpcResult<List<BatchFailedFlowsOutput>> createBatchOutcomeWithError() {
         return RpcResultBuilder.<List<BatchFailedFlowsOutput>>failed()
                 .withError(RpcError.ErrorType.APPLICATION, "ut-flowAddFail")
                 .withResult(Collections.singletonList(new BatchFailedFlowsOutputBuilder()
@@ -139,11 +143,12 @@ public class FlowUtilTest {
                 .build();
     }
 
-    private <T extends BatchFlowOutputListGrouping> void checkBatchErrorOutcomeTransformation(
+    private static <T extends BatchFlowOutputListGrouping> void checkBatchErrorOutcomeTransformation(
             final RpcResult<T> output) {
         Assert.assertFalse(output.isSuccessful());
-        Assert.assertEquals(1, output.getResult().getBatchFailedFlowsOutput().size());
-        Assert.assertEquals(DUMMY_FLOW_ID, output.getResult().getBatchFailedFlowsOutput().get(0).getFlowId());
+        Assert.assertEquals(1, output.getResult().nonnullBatchFailedFlowsOutput().size());
+        Assert.assertEquals(DUMMY_FLOW_ID,
+            output.getResult().nonnullBatchFailedFlowsOutput().values().iterator().next().getFlowId());
 
         Assert.assertEquals(1, output.getErrors().size());
     }
@@ -161,7 +166,9 @@ public class FlowUtilTest {
 
         Assert.assertTrue(composite.isSuccessful());
         Assert.assertEquals(0, composite.getErrors().size());
-        Assert.assertEquals(0, composite.getResult().getBatchFailedFlowsOutput().size());
+        Map<BatchFailedFlowsOutputKey, BatchFailedFlowsOutput> failedFlows
+                = composite.getResult().nonnullBatchFailedFlowsOutput();
+        Assert.assertEquals(0, failedFlows.size());
     }
 
     @Test
@@ -193,7 +200,9 @@ public class FlowUtilTest {
 
         Assert.assertFalse(composite.isSuccessful());
         Assert.assertEquals(1, composite.getErrors().size());
-        Assert.assertEquals(0, composite.getResult().getBatchFailedFlowsOutput().size());
+        Map<BatchFailedFlowsOutputKey, BatchFailedFlowsOutput> failedFlows
+                = composite.getResult().nonnullBatchFailedFlowsOutput();
+        Assert.assertEquals(0, failedFlows.size());
     }
 
     @Test
index 9384121a978d67ad600f86428588060a73649062..9185c4a428b578e85d5aa1eaf53d06d2218c81b4 100644 (file)
@@ -120,20 +120,20 @@ public class GroupUtilTest {
         checkBatchSuccessOutcomeTransformation(GroupUtil.GROUP_UPDATE_TRANSFORM.apply(input));
     }
 
-    private <T extends BatchGroupOutputListGrouping> void checkBatchSuccessOutcomeTransformation(
+    private static <T extends BatchGroupOutputListGrouping> void checkBatchSuccessOutcomeTransformation(
             final RpcResult<T> output) {
         Assert.assertTrue(output.isSuccessful());
-        Assert.assertEquals(0, output.getResult().getBatchFailedGroupsOutput().size());
+        Assert.assertEquals(0, output.getResult().nonnullBatchFailedGroupsOutput().size());
         Assert.assertEquals(0, output.getErrors().size());
     }
 
-    private RpcResult<List<BatchFailedGroupsOutput>> createEmptyBatchOutcome() {
+    private static RpcResult<List<BatchFailedGroupsOutput>> createEmptyBatchOutcome() {
         return RpcResultBuilder
                 .success(Collections.<BatchFailedGroupsOutput>emptyList())
                 .build();
     }
 
-    private RpcResult<List<BatchFailedGroupsOutput>> createBatchOutcomeWithError() {
+    private static RpcResult<List<BatchFailedGroupsOutput>> createBatchOutcomeWithError() {
         return RpcResultBuilder.<List<BatchFailedGroupsOutput>>failed()
                 .withError(RpcError.ErrorType.APPLICATION, "ut-flowAddFail")
                 .withResult(Collections.singletonList(new BatchFailedGroupsOutputBuilder()
@@ -142,11 +142,12 @@ public class GroupUtilTest {
                 .build();
     }
 
-    private <T extends BatchGroupOutputListGrouping> void checkBatchErrorOutcomeTransformation(
+    private static <T extends BatchGroupOutputListGrouping> void checkBatchErrorOutcomeTransformation(
             final RpcResult<T> output) {
         Assert.assertFalse(output.isSuccessful());
-        Assert.assertEquals(1, output.getResult().getBatchFailedGroupsOutput().size());
-        Assert.assertEquals(DUMMY_GROUP_ID, output.getResult().getBatchFailedGroupsOutput().get(0).getGroupId());
+        Assert.assertEquals(1, output.getResult().nonnullBatchFailedGroupsOutput().size());
+        Assert.assertEquals(DUMMY_GROUP_ID,
+            output.getResult().nonnullBatchFailedGroupsOutput().values().iterator().next().getGroupId());
 
         Assert.assertEquals(1, output.getErrors().size());
     }
@@ -164,7 +165,7 @@ public class GroupUtilTest {
 
         Assert.assertTrue(composite.isSuccessful());
         Assert.assertEquals(0, composite.getErrors().size());
-        Assert.assertEquals(0, composite.getResult().getBatchFailedGroupsOutput().size());
+        Assert.assertEquals(0, composite.getResult().nonnullBatchFailedGroupsOutput().size());
     }
 
     @Test
@@ -196,7 +197,7 @@ public class GroupUtilTest {
 
         Assert.assertFalse(composite.isSuccessful());
         Assert.assertEquals(1, composite.getErrors().size());
-        Assert.assertEquals(0, composite.getResult().getBatchFailedGroupsOutput().size());
+        Assert.assertEquals(0, composite.getResult().nonnullBatchFailedGroupsOutput().size());
     }
 
     @Test
index 7fa7ebcb02fae15ef3bc12af822d8cd866a999a2..a822c71d01c4e6492a310bf8505eb6cd67e3e561 100644 (file)
@@ -12,6 +12,7 @@ import com.google.common.base.Function;
 import com.google.common.collect.Lists;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import org.apache.commons.lang3.tuple.Pair;
 import org.junit.Assert;
 import org.junit.Test;
@@ -29,6 +30,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.Ad
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.BatchMeterOutputListGrouping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.output.list.grouping.BatchFailedMetersOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.output.list.grouping.BatchFailedMetersOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.output.list.grouping.BatchFailedMetersOutputKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -117,20 +119,20 @@ public class MeterUtilTest {
         checkBatchSuccessOutcomeTransformation(MeterUtil.METER_UPDATE_TRANSFORM.apply(input));
     }
 
-    private <T extends BatchMeterOutputListGrouping> void checkBatchSuccessOutcomeTransformation(
+    private static <T extends BatchMeterOutputListGrouping> void checkBatchSuccessOutcomeTransformation(
             final RpcResult<T> output) {
         Assert.assertTrue(output.isSuccessful());
-        Assert.assertEquals(0, output.getResult().getBatchFailedMetersOutput().size());
+        Assert.assertEquals(0, output.getResult().nonnullBatchFailedMetersOutput().size());
         Assert.assertEquals(0, output.getErrors().size());
     }
 
-    private RpcResult<List<BatchFailedMetersOutput>> createEmptyBatchOutcome() {
+    private static RpcResult<List<BatchFailedMetersOutput>> createEmptyBatchOutcome() {
         return RpcResultBuilder
                 .success(Collections.<BatchFailedMetersOutput>emptyList())
                 .build();
     }
 
-    private RpcResult<List<BatchFailedMetersOutput>> createBatchOutcomeWithError() {
+    private static RpcResult<List<BatchFailedMetersOutput>> createBatchOutcomeWithError() {
         return RpcResultBuilder.<List<BatchFailedMetersOutput>>failed()
                 .withError(RpcError.ErrorType.APPLICATION, "ut-flowAddFail")
                 .withResult(Collections.singletonList(new BatchFailedMetersOutputBuilder()
@@ -139,11 +141,12 @@ public class MeterUtilTest {
                 .build();
     }
 
-    private <T extends BatchMeterOutputListGrouping> void checkBatchErrorOutcomeTransformation(
+    private static <T extends BatchMeterOutputListGrouping> void checkBatchErrorOutcomeTransformation(
             final RpcResult<T> output) {
         Assert.assertFalse(output.isSuccessful());
-        Assert.assertEquals(1, output.getResult().getBatchFailedMetersOutput().size());
-        Assert.assertEquals(DUMMY_METER_ID, output.getResult().getBatchFailedMetersOutput().get(0).getMeterId());
+        Assert.assertEquals(1, output.getResult().nonnullBatchFailedMetersOutput().size());
+        Assert.assertEquals(DUMMY_METER_ID,
+            output.getResult().nonnullBatchFailedMetersOutput().values().iterator().next().getMeterId());
 
         Assert.assertEquals(1, output.getErrors().size());
     }
@@ -161,7 +164,9 @@ public class MeterUtilTest {
 
         Assert.assertTrue(composite.isSuccessful());
         Assert.assertEquals(0, composite.getErrors().size());
-        Assert.assertEquals(0, composite.getResult().getBatchFailedMetersOutput().size());
+        Map<BatchFailedMetersOutputKey, BatchFailedMetersOutput> failedMeters
+                = composite.getResult().nonnullBatchFailedMetersOutput();
+        Assert.assertEquals(0, failedMeters.size());
     }
 
     @Test
@@ -193,7 +198,9 @@ public class MeterUtilTest {
 
         Assert.assertFalse(composite.isSuccessful());
         Assert.assertEquals(1, composite.getErrors().size());
-        Assert.assertEquals(0, composite.getResult().getBatchFailedMetersOutput().size());
+        Map<BatchFailedMetersOutputKey, BatchFailedMetersOutput> failedMeters
+                = composite.getResult().nonnullBatchFailedMetersOutput();
+        Assert.assertEquals(0, failedMeters.size());
     }
 
     @Test
@@ -221,7 +228,7 @@ public class MeterUtilTest {
     private RpcResult<AddMetersBatchOutput> createAddMetersBatchSuccessOutput() {
         return RpcResultBuilder
                 .success(new AddMetersBatchOutputBuilder()
-                        .setBatchFailedMetersOutput(Collections.emptyList())
+                        .setBatchFailedMetersOutput(Collections.emptyMap())
                         .build())
                 .build();
     }
index 46ff894ff83927616612dbb42c84017cbab35bbc..afc7db0ca7a19c3f291408fb0dcdbd71abbc346f 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.extension;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Optional;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
@@ -68,13 +69,15 @@ public final class MatchExtensionHelper {
 
         final ExtensionListBuilder extBuilder = processExtension(matchEntry, ofVersion, matchPath);
 
+        // TODO: remove the Optional.ofNullable() here, which will result more performant and easier to understand code
         final GeneralAugMatchNodesNodeTableFlowBuilder builder = Optional
                 .ofNullable(matchBuilder.augmentation(GeneralAugMatchNodesNodeTableFlow.class))
                 .map(GeneralAugMatchNodesNodeTableFlowBuilder::new)
-                .orElse(new GeneralAugMatchNodesNodeTableFlowBuilder().setExtensionList(new ArrayList<>()));
+                .orElse(new GeneralAugMatchNodesNodeTableFlowBuilder().setExtensionList(new HashMap<>()));
 
         if (extBuilder != null) {
-            builder.getExtensionList().add(extBuilder.build());
+            final ExtensionList ext = extBuilder.build();
+            builder.getExtensionList().put(ext.key(), ext);
         } else {
             LOG.warn("Convertor for {} for version {} with match path {} not found.",
                     matchEntry, ofVersion, matchPath.name());
@@ -97,13 +100,15 @@ public final class MatchExtensionHelper {
             final Collection<MatchEntry> matchEntries, final OpenflowVersion ofVersion, final MatchPath matchPath) {
         List<ExtensionList> extensionsList = new ArrayList<>();
 
-        for (MatchEntry matchEntry : matchEntries) {
-            ExtensionListBuilder extensionListBld = processExtension(matchEntry, ofVersion.getVersion(), matchPath);
-            if (extensionListBld == null) {
-                continue;
-            }
+        if (matchEntries != null) {
+            for (MatchEntry matchEntry : matchEntries) {
+                ExtensionListBuilder extensionListBld = processExtension(matchEntry, ofVersion.getVersion(), matchPath);
+                if (extensionListBld == null) {
+                    continue;
+                }
 
-            extensionsList.add(extensionListBld.build());
+                extensionsList.add(extensionListBld.build());
+            }
         }
 
         AugmentTuple<E> augmentTuple = null;
index a1a77da697cfe7336fd05c4d1d62f859c08ab810..047844797177169537c1c6a5e1c9df6d3fac8709 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
 
 import java.util.Collection;
+import java.util.Map;
 import java.util.Optional;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData;
 
@@ -36,4 +37,17 @@ public interface ConvertorExecutor {
      * @return the result (can be empty, if no convertor was found)
      */
     <F, T, D extends ConvertorData> Optional<T> convert(Collection<F> source, D data);
+
+    /**
+     * Lookup and use convertor by specified type, then converts source collection and returns converted result.
+     *
+     * @param <K> the source key type
+     * @param <F> the source value type
+     * @param <T>   the result type
+     * @param <D> the data type
+     * @param source the source collection
+     * @param data   convertor data
+     * @return the result (can be empty, if no convertor was found)
+     */
+    <K, F, T, D extends ConvertorData> Optional<T> convert(Map<K, F> source, D data);
 }
index 69382d00106087f49ebef36a0e33fdb680b117bf..42c6af9f7b0b09e50a14afcff005a6a508d33fe4 100644 (file)
@@ -96,6 +96,36 @@ public class ConvertorManager implements ConvertorExecutor, ConvertorRegistrator
         return findConvertor(data.getVersion(), type).map(convertor -> (T)convertor.convert(source, data));
     }
 
+    @Override
+    @SuppressWarnings("unchecked")
+    public <K, F, T, D extends ConvertorData> Optional<T> convert(final Map<K, F> source, final D data) {
+        Optional<T> result = Optional.empty();
+
+        if (source == null) {
+            LOG.trace("Cannot extract type from null source");
+            return result;
+        }
+
+        final Optional<F> firstOptional = source.values().stream().findFirst();
+
+        if (!firstOptional.isPresent()) {
+            LOG.trace("Cannot extract type from empty collection");
+            return result;
+        }
+
+        final F first = firstOptional.get();
+
+        final Class<?> type = first instanceof DataContainer ? ((DataContainer) first).implementedInterface()
+                : first.getClass();
+
+        if (type == null) {
+            LOG.warn("Cannot extract type from {}, because implementedInterface() returns null", source);
+            return result;
+        }
+
+        return findConvertor(data.getVersion(), type).map(convertor -> (T)convertor.convert(source.values(), data));
+    }
+
     @Override
     @SuppressWarnings("unchecked")
     public <F, T, D extends ConvertorData> Optional<T> convert(final Collection<F> source, final D data) {
index 84fa9a3b4d31efc083f28609ce271d4e270d4fed..3432d6964dbc2e39f974ebb9106a1f4cbe1766bc 100644 (file)
@@ -14,6 +14,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import org.opendaylight.openflowjava.protocol.api.util.BinContent;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
@@ -25,9 +26,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.gro
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.Buckets;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupModCommand;
@@ -83,14 +83,14 @@ public class GroupConvertor extends Convertor<Group, GroupModInputBuilder, Versi
         return bucket1.getBucketId().getValue().compareTo(bucket2.getBucketId().getValue());
     };
 
-    private List<BucketsList> salToOFBucketList(final Buckets buckets, final short version, final int groupType,
+    private List<BucketsList> salToOFBucketList(final List<Bucket> buckets, final short version, final int groupType,
             final Uint64 datapathid) {
         final List<BucketsList> bucketLists = new ArrayList<>();
         final ActionConvertorData data = new ActionConvertorData(version);
         data.setDatapathId(datapathid);
 
         for (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket groupBucket :
-                buckets.getBucket()) {
+                buckets) {
             BucketsListBuilder bucketBuilder = new BucketsListBuilder();
 
             salToOFBucketListWeight(groupBucket, bucketBuilder, groupType);
@@ -182,17 +182,18 @@ public class GroupConvertor extends Convertor<Group, GroupModInputBuilder, Versi
         // Only if the bucket is configured for the group then add it
         // During group deletion do not push the buckets
         if (groupModInputBuilder.getCommand() != GroupModCommand.OFPGCDELETE) {
-            if (source.getBuckets() != null && source.getBuckets().getBucket().size() != 0) {
-
-                List<Bucket> bucketList = new ArrayList<>(source.getBuckets().getBucket());
-                Group group = new GroupBuilder(source)
-                        .setBuckets(new BucketsBuilder().setBucket(bucketList).build())
-                        .build();
-                Collections.sort(group.getBuckets().getBucket(), COMPARATOR);
-
-                List<BucketsList> bucketLists = salToOFBucketList(group.getBuckets(), data.getVersion(),
-                        group.getGroupType().getIntValue(), data.getDatapathId());
-                groupModInputBuilder.setBucketsList(bucketLists);
+            final Buckets buckets = source.getBuckets();
+            if (buckets != null) {
+                final Map<BucketKey, Bucket> bucket = buckets.nonnullBucket();
+                if (!bucket.isEmpty()) {
+                    // TODO: we should be able to just sort the resulting the resulting list and not go through
+                    //       two copies
+                    List<Bucket> bucketList = new ArrayList<>(bucket.values());
+                    Collections.sort(bucketList, COMPARATOR);
+                    List<BucketsList> bucketLists = salToOFBucketList(bucketList, data.getVersion(),
+                        source.getGroupType().getIntValue(), data.getDatapathId());
+                    groupModInputBuilder.setBucketsList(bucketLists);
+                }
             }
         }
 
index c82a569469c7837a493822901d3bab13210ca24d..b4f715de97a62c7fcd6997f19a31ff037aa5395f 100644 (file)
@@ -111,7 +111,7 @@ public class GroupDescStatsResponseConvertor extends Convertor<List<GroupDesc>,
         for (GroupDesc groupDesc : source) {
             GroupDescStatsBuilder salGroupDescStats = new GroupDescStatsBuilder();
 
-            salGroupDescStats.setBuckets(toSALBucketsDesc(groupDesc.getBucketsList(), data.getVersion()));
+            salGroupDescStats.setBuckets(toSALBucketsDesc(groupDesc.nonnullBucketsList(), data.getVersion()));
             salGroupDescStats.setGroupId(new GroupId(groupDesc.getGroupId().getValue()));
             salGroupDescStats.setGroupType(GroupTypes.forValue(groupDesc.getType().getIntValue()));
             salGroupDescStats.withKey(new GroupDescStatsKey(salGroupDescStats.getGroupId()));
index 8e7a0ecd73ce2db9f1e4c89196442bfff6440a49..591ffa06bd17d72952479d0b24176d1b1065dafb 100644 (file)
@@ -52,7 +52,7 @@ public class GroupStatsResponseConvertor extends Convertor<
             .openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart
                 .reply.group.GroupStats.class);
 
-    private Buckets toSALBuckets(List<BucketStats> bucketStats) {
+    private static Buckets toSALBuckets(List<BucketStats> bucketStats) {
         BucketsBuilder salBuckets = new BucketsBuilder();
 
         List<BucketCounter> allBucketStats = new ArrayList<>();
@@ -88,7 +88,7 @@ public class GroupStatsResponseConvertor extends Convertor<
                 .body.multipart.reply.group._case.multipart.reply.group.GroupStats groupStats : source) {
             GroupStatsBuilder salGroupStats = new GroupStatsBuilder();
 
-            salGroupStats.setBuckets(toSALBuckets(groupStats.getBucketStats()));
+            salGroupStats.setBuckets(toSALBuckets(groupStats.nonnullBucketStats()));
             salGroupStats.setByteCount(new Counter64(groupStats.getByteCount()));
 
             DurationBuilder time = new DurationBuilder();
index dbcdc32a3650d7b81bc29680f7ff011f3efbb287..dd12e99f043dd2ef9f4379cc805e3f34012d451d 100644 (file)
@@ -62,7 +62,7 @@ public class MeterConfigStatsResponseConvertor extends Convertor<List<MeterConfi
     }
 
     @Override
-    public List<MeterConfigStats> convert(List<MeterConfig> source, VersionConvertorData data) {
+    public List<MeterConfigStats> convert(final List<MeterConfig> source, final VersionConvertorData data) {
         List<MeterConfigStats> listMeterConfigStats = new ArrayList<>();
 
         for (MeterConfig meterConfig : source) {
@@ -70,7 +70,6 @@ public class MeterConfigStatsResponseConvertor extends Convertor<List<MeterConfi
             meterConfigStatsBuilder.setMeterId(new MeterId(meterConfig.getMeterId().getValue()));
             meterConfigStatsBuilder.withKey(new MeterConfigStatsKey(meterConfigStatsBuilder.getMeterId()));
             MeterBandHeadersBuilder meterBandHeadersBuilder = new MeterBandHeadersBuilder();
-            List<Bands> bands = meterConfig.getBands();
 
             MeterFlags meterFlags = new MeterFlags(meterConfig.getFlags().isOFPMFBURST(),
                     meterConfig.getFlags().isOFPMFKBPS(),
@@ -81,7 +80,7 @@ public class MeterConfigStatsResponseConvertor extends Convertor<List<MeterConfi
             List<MeterBandHeader> listBandHeaders = new ArrayList<>();
             int bandKey = 0;
 
-            for (Bands band : bands) {
+            for (Bands band : meterConfig.nonnullBands()) {
                 MeterBandHeaderBuilder meterBandHeaderBuilder = new MeterBandHeaderBuilder();
                 if (band.getMeterBand() instanceof MeterBandDropCase) {
                     MeterBandDropCase dropCaseBand = (MeterBandDropCase) band.getMeterBand();
@@ -120,6 +119,7 @@ public class MeterConfigStatsResponseConvertor extends Convertor<List<MeterConfi
                     MeterBandTypesBuilder meterBandTypesBuilder = new MeterBandTypesBuilder();
                     meterBandTypesBuilder.setFlags(new MeterBandType(false, true, false));
                     meterBandHeaderBuilder.setMeterBandTypes(meterBandTypesBuilder.build());
+                    meterBandHeaderBuilder.withKey(new MeterBandHeaderKey(bandId));
                     listBandHeaders.add(meterBandHeaderBuilder.build());
 
                 } else if (band.getMeterBand() instanceof MeterBandExperimenterCase) {
@@ -139,11 +139,11 @@ public class MeterConfigStatsResponseConvertor extends Convertor<List<MeterConfi
                     MeterBandTypesBuilder meterBandTypesBuilder = new MeterBandTypesBuilder();
                     meterBandTypesBuilder.setFlags(new MeterBandType(false, false, true));
                     meterBandHeaderBuilder.setMeterBandTypes(meterBandTypesBuilder.build());
+                    meterBandHeaderBuilder.withKey(new MeterBandHeaderKey(bandId));
 
                     listBandHeaders.add(meterBandHeaderBuilder.build());
 
                 }
-
                 bandKey++;
             }
 
index d6d6460660a8ac32a0c6b73186787377cf17e8d6..bd3c9a1364c84ca85450111ffc047d4f3dbe838c 100644 (file)
@@ -67,14 +67,14 @@ public class MeterConvertor extends Convertor<Meter, MeterModInputBuilder, Versi
      * @param version Openflow version
      * @return default empty meter mod input builder
      */
-    public static MeterModInputBuilder defaultResult(short version) {
+    public static MeterModInputBuilder defaultResult(final short version) {
         return new MeterModInputBuilder()
                 .setVersion(version)
                 .setFlags(new MeterFlags(false, false, true, false));
     }
 
-    private static void getBandsFromSAL(MeterBandHeaders meterBandHeaders, List<Bands> bands) {
-        for (MeterBandHeader meterBandHeader : meterBandHeaders.getMeterBandHeader()) {
+    private static void getBandsFromSAL(final MeterBandHeaders meterBandHeaders, final List<Bands> bands) {
+        for (MeterBandHeader meterBandHeader : meterBandHeaders.nonnullMeterBandHeader().values()) {
             // The band types :drop,DSCP_Remark or experimenter.
             if (null != meterBandHeader.getMeterBandTypes() && null != meterBandHeader.getMeterBandTypes().getFlags()) {
                 if (meterBandHeader.getMeterBandTypes().getFlags().isOfpmbtDrop()) {
@@ -152,7 +152,7 @@ public class MeterConvertor extends Convertor<Meter, MeterModInputBuilder, Versi
     }
 
     @Override
-    public MeterModInputBuilder convert(Meter source, VersionConvertorData data) {
+    public MeterModInputBuilder convert(final Meter source, final VersionConvertorData data) {
         MeterModInputBuilder meterModInputBuilder = new MeterModInputBuilder();
         List<Bands> bands = new ArrayList<>();
 
index 39d1dc7141a7cb875b6d0e82963c8b1a318c4647..5fb610cfcbff98464b3f7722dcf06e69d8ce66ae 100644 (file)
@@ -78,7 +78,7 @@ public class MeterStatsResponseConvertor extends Convertor<
             salMeterStats.setPacketInCount(new Counter64(meterStats.getPacketInCount()));
             salMeterStats.withKey(new MeterStatsKey(salMeterStats.getMeterId()));
 
-            List<MeterBandStats> allMeterBandStats = meterStats.getMeterBandStats();
+            List<MeterBandStats> allMeterBandStats = meterStats.nonnullMeterBandStats();
 
             MeterBandStatsBuilder meterBandStatsBuilder = new MeterBandStatsBuilder();
             List<BandStat> listAllBandStats = new ArrayList<>();
index 24679eadb3a968d98ac909895172a8c8ead3e43b..dbdec7239b2018d190ac395b378aecceeac9bb40 100644 (file)
@@ -12,6 +12,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import org.opendaylight.controller.sal.common.util.Arguments;
@@ -120,11 +121,12 @@ public class PacketOutConvertor extends Convertor<TransmitPacketInput, PacketOut
             LOG.error("PORT NR not exist in Egress");
         }
 
-        List<Action> actions = new ArrayList<>();
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> inputActions =
-                source.getAction();
+        final List<Action> actions;
+        Map<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey,
+            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> inputActions =
+                source.nonnullAction();
 
-        if (inputActions != null) {
+        if (!inputActions.isEmpty()) {
             final ActionConvertorData actionConvertorData = new ActionConvertorData(data.getVersion());
             actionConvertorData.setDatapathId(data.getDatapathId());
 
@@ -142,6 +144,7 @@ public class PacketOutConvertor extends Convertor<TransmitPacketInput, PacketOut
             outputActionCaseBuilder.setOutputAction(outputActionBuilder.build());
             ActionBuilder actionBuild = new ActionBuilder();
             actionBuild.setActionChoice(outputActionCaseBuilder.build());
+            actions = new ArrayList<>();
             actions.add(actionBuild.build());
         }
 
index f508f02d9fe1562f3bd5fab3c5eccfc5d38858fb..c09d1e87b4a3c6ffda9c49955292aa325da4e540 100644 (file)
@@ -42,10 +42,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlags;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeatureProperty;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeaturePropertyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeatureProperty;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeaturePropertyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeatureProperty;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeaturePropertyBuilder;
@@ -129,6 +128,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActions;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss;
@@ -250,7 +251,7 @@ public class TableFeaturesConvertor extends Convertor<
 
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table
             .properties.TableFeatureProperties> sortedTableProperties = TABLE_FEATURE_PROPS_ORDERING.sortedCopy(
-                    tableProperties.getTableFeatureProperties());
+                    tableProperties.nonnullTableFeatureProperties().values());
 
         for (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table
                 .properties.TableFeatureProperties property : sortedTableProperties) {
@@ -304,107 +305,95 @@ public class TableFeaturesConvertor extends Convertor<
 
     private static void setTableFeatureProperty(final ApplySetfieldMiss propType,
             final TableFeaturePropertiesBuilder propBuilder) {
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>
-            setFieldMatch = null;
+        Map<SetFieldMatchKey, SetFieldMatch> setFieldMatch = null;
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
             .type.apply.setfield.miss.ApplySetfieldMiss applySetfieldMiss = propType.getApplySetfieldMiss();
 
         if (null != applySetfieldMiss) {
-            setFieldMatch = applySetfieldMiss.getSetFieldMatch();
+            setFieldMatch = applySetfieldMiss.nonnullSetFieldMatch();
         }
 
         setSetFieldTableFeatureProperty(
                 propBuilder,
                 TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS,
-                setFieldMatch == null ? new ArrayList<>()
-                        : setFieldMatch);
+                setFieldMatch == null ? Collections.emptyMap() : setFieldMatch);
     }
 
     private static void setTableFeatureProperty(final ApplySetfield propType,
             final TableFeaturePropertiesBuilder propBuilder) {
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>
-            setFieldMatch = null;
+        Map<SetFieldMatchKey, SetFieldMatch> setFieldMatch = null;
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
             .type.apply.setfield.ApplySetfield applySetfield = propType.getApplySetfield();
 
         if (null != applySetfield) {
-            setFieldMatch = applySetfield.getSetFieldMatch();
+            setFieldMatch = applySetfield.nonnullSetFieldMatch();
         }
 
         setSetFieldTableFeatureProperty(
                 propBuilder,
                 TableFeaturesPropType.OFPTFPTAPPLYSETFIELD,
-                setFieldMatch == null ? new ArrayList<>()
-                        : setFieldMatch);
+                setFieldMatch == null ? Collections.emptyMap() : setFieldMatch);
     }
 
     private static void setTableFeatureProperty(final WriteSetfieldMiss propType,
             final TableFeaturePropertiesBuilder propBuilder) {
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>
-            setFieldMatch = null;
+        Map<SetFieldMatchKey, SetFieldMatch> setFieldMatch = null;
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
             .type.write.setfield.miss.WriteSetfieldMiss writeSetfieldMiss = propType.getWriteSetfieldMiss();
 
         if (null != writeSetfieldMiss) {
-            setFieldMatch = writeSetfieldMiss.getSetFieldMatch();
+            setFieldMatch = writeSetfieldMiss.nonnullSetFieldMatch();
         }
 
         setSetFieldTableFeatureProperty(
                 propBuilder,
                 TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS,
-                setFieldMatch == null ? new ArrayList<>()
-                        : setFieldMatch);
+                setFieldMatch == null ? Collections.emptyMap() : setFieldMatch);
     }
 
     private static void setTableFeatureProperty(final WriteSetfield propType,
             final TableFeaturePropertiesBuilder propBuilder) {
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>
-            setFieldMatch = null;
+        Map<SetFieldMatchKey, SetFieldMatch> setFieldMatch = null;
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
             .type.write.setfield.WriteSetfield writeSetField = propType.getWriteSetfield();
 
         if (null != writeSetField) {
-            setFieldMatch = writeSetField.getSetFieldMatch();
+            setFieldMatch = writeSetField.nonnullSetFieldMatch();
         }
 
         setSetFieldTableFeatureProperty(
                 propBuilder,
                 TableFeaturesPropType.OFPTFPTWRITESETFIELD,
-                setFieldMatch == null ? new ArrayList<>()
-                        : setFieldMatch);
+                setFieldMatch == null ? Collections.emptyMap() : setFieldMatch);
     }
 
     private static void setTableFeatureProperty(final Wildcards propType,
             final TableFeaturePropertiesBuilder propBuilder) {
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>
-            setFieldMatch = null;
+        Map<SetFieldMatchKey, SetFieldMatch> setFieldMatch = null;
         WildcardSetfield wildcardSetField = propType.getWildcardSetfield();
 
         if (null != wildcardSetField) {
-            setFieldMatch = wildcardSetField.getSetFieldMatch();
+            setFieldMatch = wildcardSetField.nonnullSetFieldMatch();
         }
 
         setSetFieldTableFeatureProperty(
                 propBuilder,
                 TableFeaturesPropType.OFPTFPTWILDCARDS,
-                setFieldMatch == null ? new ArrayList<>()
-                        : setFieldMatch);
+                setFieldMatch == null ? Collections.emptyMap() : setFieldMatch);
     }
 
     private static void setTableFeatureProperty(final Match propType, final TableFeaturePropertiesBuilder propBuilder) {
         MatchSetfield matchSetField = propType.getMatchSetfield();
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>
-            setFieldMatch = null;
+        Map<SetFieldMatchKey, SetFieldMatch> setFieldMatch = null;
 
         if (null != matchSetField) {
-            setFieldMatch = matchSetField.getSetFieldMatch();
+            setFieldMatch = matchSetField.nonnullSetFieldMatch();
         }
 
         setSetFieldTableFeatureProperty(
                 propBuilder,
                 TableFeaturesPropType.OFPTFPTMATCH,
-                setFieldMatch == null ? new ArrayList<>()
-                        : setFieldMatch);
+                setFieldMatch == null ? Collections.emptyMap() : setFieldMatch);
     }
 
     private static void setTableFeatureProperty(final ApplyActionsMiss propType,
@@ -414,8 +403,7 @@ public class TableFeaturesConvertor extends Convertor<
         setActionTableFeatureProperty(
                 propBuilder,
                 TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS,
-                applyActionsMiss == null ? new ArrayList<>()
-                        : applyActionsMiss.getAction());
+                applyActionsMiss == null ? Collections.emptyMap() : applyActionsMiss.nonnullAction());
     }
 
     private static void setTableFeatureProperty(final ApplyActions propType,
@@ -425,8 +413,7 @@ public class TableFeaturesConvertor extends Convertor<
         setActionTableFeatureProperty(
                 propBuilder,
                 TableFeaturesPropType.OFPTFPTAPPLYACTIONS,
-                applyActions == null ? new ArrayList<>()
-                        : applyActions.getAction());
+                applyActions == null ? Collections.emptyMap() : applyActions.nonnullAction());
     }
 
     private static void setTableFeatureProperty(final WriteActionsMiss propType,
@@ -436,8 +423,7 @@ public class TableFeaturesConvertor extends Convertor<
         setActionTableFeatureProperty(
                 propBuilder,
                 TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS,
-                writeActionsMiss == null ? new ArrayList<>()
-                        : writeActionsMiss.getAction());
+                writeActionsMiss == null ? Collections.emptyMap() : writeActionsMiss.nonnullAction());
     }
 
     private static void setTableFeatureProperty(final WriteActions propType,
@@ -447,8 +433,7 @@ public class TableFeaturesConvertor extends Convertor<
         setActionTableFeatureProperty(
                 propBuilder,
                 TableFeaturesPropType.OFPTFPTWRITEACTIONS,
-                writeActions == null ? new ArrayList<>()
-                        : writeActions.getAction());
+                writeActions == null ? Collections.emptyMap() : writeActions.nonnullAction());
     }
 
     private static void setTableFeatureProperty(final NextTableMiss propType,
@@ -471,7 +456,7 @@ public class TableFeaturesConvertor extends Convertor<
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
             .type.instructions.miss.InstructionsMiss instructions = propType.getInstructionsMiss();
         setInstructionTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS,
-                instructions == null ? new ArrayList<>() : instructions.getInstruction());
+                instructions == null ? Collections.emptyMap() : instructions.nonnullInstruction());
     }
 
     private static void setTableFeatureProperty(final Instructions propType,
@@ -479,15 +464,15 @@ public class TableFeaturesConvertor extends Convertor<
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
             .type.instructions.Instructions instructions = propType.getInstructions();
         setInstructionTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTINSTRUCTIONS,
-                instructions == null ? new ArrayList<>() : instructions.getInstruction());
+                instructions == null ? Collections.emptyMap() : instructions.nonnullInstruction());
     }
 
     private static void setInstructionTableFeatureProperty(final TableFeaturePropertiesBuilder builder,
-            final TableFeaturesPropType type, final List<Instruction> instructionList) {
+            final TableFeaturesPropType type, final Map<InstructionKey, Instruction> instructionList) {
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping
-            .Instruction> instructionTypeList = new ArrayList<>();
+            .Instruction> instructionTypeList = new ArrayList<>(instructionList.size());
 
-        for (Instruction currInstruction : instructionList) {
+        for (Instruction currInstruction : instructionList.values()) {
             InstructionBuilder instructionType = new InstructionBuilder();
 
             org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction instruction =
@@ -520,7 +505,7 @@ public class TableFeaturesConvertor extends Convertor<
         InstructionRelatedTableFeaturePropertyBuilder propBuilder = new InstructionRelatedTableFeaturePropertyBuilder();
         propBuilder.setInstruction(instructionTypeList);
         builder.setType(type);
-        builder.addAugmentation(InstructionRelatedTableFeatureProperty.class, propBuilder.build());
+        builder.addAugmentation(propBuilder.build());
     }
 
     private static void setNextTableFeatureProperty(final TableFeaturePropertiesBuilder builder,
@@ -541,13 +526,14 @@ public class TableFeaturesConvertor extends Convertor<
 
     private static void setActionTableFeatureProperty(final TableFeaturePropertiesBuilder builder,
             final TableFeaturesPropType type,
-            final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>
-                salActions) {
+            final Map<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey,
+                      org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>
+                  salActions) {
 
-        List<Action> actionList = new ArrayList<>();
+        List<Action> actionList = new ArrayList<>(salActions.size());
 
         for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action currAction :
-                salActions) {
+                salActions.values()) {
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionType = currAction
                     .getAction();
             ActionBuilder actionBuilder = new ActionBuilder();
@@ -609,18 +595,16 @@ public class TableFeaturesConvertor extends Convertor<
         ActionRelatedTableFeaturePropertyBuilder propBuilder = new ActionRelatedTableFeaturePropertyBuilder();
         propBuilder.setAction(actionList);
         builder.setType(type);
-        builder.addAugmentation(ActionRelatedTableFeatureProperty.class, propBuilder.build());
+        builder.addAugmentation(propBuilder.build());
     }
 
     private static void setSetFieldTableFeatureProperty(
             final TableFeaturePropertiesBuilder builder,
             final TableFeaturesPropType type,
-            final List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match
-                .SetFieldMatch> setFields) {
+            final Map<SetFieldMatchKey, SetFieldMatch> setFields) {
         List<MatchEntry> matchEntriesList = new ArrayList<>();
 
-        for (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch
-                currMatch : setFields) {
+        for (SetFieldMatch currMatch : setFields.values()) {
             Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField>
                 currMatchType = currMatch.getMatchType();
             MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
@@ -661,7 +645,7 @@ public class TableFeaturesConvertor extends Convertor<
         TableFeaturesBuilder ofTableFeatures = new TableFeaturesBuilder();
 
         for (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures
-                salTableFeatures : source.getTableFeatures()) {
+                salTableFeatures : source.nonnullTableFeatures().values()) {
             ofTableFeatures.setTableId(salTableFeatures.getTableId());
             ofTableFeatures.setName(salTableFeatures.getName());
             ofTableFeatures.setMetadataMatch(salTableFeatures.getMetadataMatch());
index a8995ca118d928b6764b6ee293e8abb67fff2a91..b60b517bc2ef46142e15373e94c21bec17b33c8d 100644 (file)
@@ -77,8 +77,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
  * </pre>
  */
 public final class ActionConvertor extends Convertor<
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>,
-        List<Action>,
+        Collection<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>,
+        Collection<Action>,
         ActionConvertorData> {
 
     private static final ConvertorProcessor<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
@@ -143,7 +143,7 @@ public final class ActionConvertor extends Convertor<
     }
 
     @Override
-    public List<Action> convert(List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action
+    public List<Action> convert(Collection<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action
             .list.Action> source, ActionConvertorData data) {
         // Prepare list of converted actions
         final List<Action> result = new ArrayList<>();
index e6ecda79d6ca1994a3149503dc64dfbbc73c3c14..d43253d0872a66d690b951c30b8a1e20dee3a599 100644 (file)
@@ -17,6 +17,7 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
@@ -37,6 +38,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
 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.RemoveFlowInput;
@@ -312,7 +314,7 @@ public class FlowConvertor extends Convertor<Flow, List<FlowModInputBuilder>, Ve
         Instructions instructions = flow.getInstructions();
 
         for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction
-                instruction : instructions.getInstruction()) {
+                instruction : instructions.nonnullInstruction().values()) {
             org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction
                 curInstruction = instruction.getInstruction();
 
@@ -329,7 +331,7 @@ public class FlowConvertor extends Convertor<Flow, List<FlowModInputBuilder>, Ve
     private List<Action> getActions(final short version, final Uint64 datapathid, final Flow flow) {
         Instructions instructions = flow.getInstructions();
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction>
-            sortedInstructions = INSTRUCTION_ORDERING.sortedCopy(instructions.getInstruction());
+            sortedInstructions = INSTRUCTION_ORDERING.sortedCopy(instructions.nonnullInstruction().values());
 
         for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction
                 instruction : sortedInstructions) {
@@ -360,7 +362,7 @@ public class FlowConvertor extends Convertor<Flow, List<FlowModInputBuilder>, Ve
         // If yes,then we would need to two flows
         if (flow.getInstructions() != null && flow.getInstructions().getInstruction() != null) {
             for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction
-                    instruction : flow.getInstructions().getInstruction()) {
+                    instruction : flow.getInstructions().nonnullInstruction().values()) {
                 org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction
                     curInstruction = instruction.getInstruction();
 
@@ -371,7 +373,7 @@ public class FlowConvertor extends Convertor<Flow, List<FlowModInputBuilder>, Ve
                                 .rev131026.instruction.instruction.ApplyActionsCase) curInstruction;
                     ApplyActions applyActions = applyActionscase.getApplyActions();
                     for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action
-                            action : applyActions.getAction()) {
+                            action : applyActions.nonnullAction().values()) {
                         if (action.getAction() instanceof SetVlanIdActionCase) {
                             return true;
                         }
@@ -470,8 +472,9 @@ public class FlowConvertor extends Convertor<Flow, List<FlowModInputBuilder>, Ve
     private static List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction>
             injectPushActionToInstruction(final Flow sourceFlow) {
 
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction>
-            srcInstructionList = sourceFlow.getInstructions().getInstruction();
+        Map<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey,
+            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction>
+            srcInstructionList = sourceFlow.getInstructions().nonnullInstruction();
 
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction>
             targetInstructionList = new ArrayList<>(srcInstructionList.size());
@@ -483,7 +486,7 @@ public class FlowConvertor extends Convertor<Flow, List<FlowModInputBuilder>, Ve
                 .list.InstructionBuilder();
 
         for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction
-                srcInstruction : srcInstructionList) {
+                srcInstruction : srcInstructionList.values()) {
             org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction
                 curSrcInstruction = srcInstruction.getInstruction();
 
@@ -493,12 +496,13 @@ public class FlowConvertor extends Convertor<Flow, List<FlowModInputBuilder>, Ve
                     .ApplyActionsCase applyActionscase = (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types
                             .rev131026.instruction.instruction.ApplyActionsCase) curSrcInstruction;
                 ApplyActions applyActions = applyActionscase.getApplyActions();
-                List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>
-                     srcActionList = applyActions.getAction();
+                Map<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey,
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>
+                     srcActionList = applyActions.nonnullAction();
 
                 int offset = 0;
                 for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action
-                        actionItem : srcActionList) {
+                        actionItem : srcActionList.values()) {
                     // check if its a set-vlan-action. If yes, then add the injected-action
 
                     if (actionItem.getAction() instanceof SetVlanIdActionCase) {
@@ -527,7 +531,8 @@ public class FlowConvertor extends Convertor<Flow, List<FlowModInputBuilder>, Ve
                         // we need to increment the order for all the actions added after injection
                         ActionBuilder actionBuilder =
                                 new ActionBuilder(actionItem);
-                        actionBuilder.setOrder(actionItem.getOrder() + offset);
+                        actionBuilder.setOrder(actionItem.getOrder() + offset)
+                                .withKey(new ActionKey(actionItem.key().getOrder() + offset));
                         actionItem = actionBuilder.build();
                     }
 
index 5d100f5939da217458414532125c0cff231515f3..0f61101c08c14a43287b85694d2517ca6ef0a9a9 100644 (file)
@@ -156,7 +156,7 @@ public class FlowStatsResponseConvertor extends Convertor<List<FlowStats>, List<
 
                     final AugmentTuple<Match> matchExtensionWrap =
                             MatchExtensionHelper.processAllExtensions(
-                                    flowStats.getMatch().getMatchEntry(),
+                                    flowStats.getMatch().nonnullMatchEntry(),
                                     OpenflowVersion.get(data.getVersion()),
                                     data.getMatchPath());
 
index 6901fe2583376bbb80cc78a578d3457af735af3b..61bf949563abc937f0253d43fdc7d3e4141e0d03 100644 (file)
@@ -652,8 +652,7 @@ public class MatchConvertor extends Convertor<Match, List<MatchEntry>, VersionCo
         Optional<GeneralExtensionListGrouping> extensionListOpt =
                 ExtensionResolvers.getMatchExtensionResolver().getExtension(source);
         if (extensionListOpt.isPresent()) {
-            List<ExtensionList> extensionListList = extensionListOpt.get().getExtensionList();
-            for (ExtensionList extensionItem : extensionListList) {
+            for (ExtensionList extensionItem : extensionListOpt.get().nonnullExtensionList().values()) {
                 // TODO: get real version
                 ConverterExtensionKey<? extends ExtensionKey> key =
                         new ConverterExtensionKey<>(extensionItem.getExtensionKey(), OFConstants.OFP_VERSION_1_3);
index b5908b737770367c213281a7d89d83406db6840a..e41040829789ec43dd2820962712158cb097d028 100644 (file)
@@ -178,7 +178,7 @@ public class MatchResponseConvertor extends Convertor<MatchEntriesGrouping, Matc
         data.setTunnelIpv4MatchBuilder(new TunnelIpv4MatchBuilder());
         data.setTcpFlagsMatchBuilder(new TcpFlagsMatchBuilder());
 
-        for (MatchEntry ofMatch : source.getMatchEntry()) {
+        for (MatchEntry ofMatch : source.nonnullMatchEntry()) {
             if (TunnelIpv4Dst.class.isAssignableFrom(ofMatch.getOxmMatchField())
                     || TunnelIpv4Src.class.isAssignableFrom(ofMatch.getOxmMatchField())) {
                 /*
index c3c5f42a7d2cf9f45268f9eb6b410c632fe627f7..9c7444fe577bea13ee4aeded9568d2b480c9cb51 100644 (file)
@@ -5,7 +5,6 @@
  * 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.openflowplugin.openflow.md.core.extension;
 
 import static org.junit.Assert.assertNotNull;
@@ -41,18 +40,24 @@ public class MatchExtensionHelperTest {
 
     @Mock
     private ExtensionConverterProvider extensionConverterProvider;
-    private static final int PRESET_COUNT = 7;
-    private static final MatchEntrySerializerKey<? extends OxmClassBase, ? extends MatchField> KEY =
-        new MatchEntrySerializerKey<>(OpenflowVersion.OF13.getVersion(), MockOxmClassBase.class, MockMatchField.class);
+    private static final MatchEntrySerializerKey<? extends OxmClassBase, ? extends MatchField> KEY_1 =
+        new MatchEntrySerializerKey<>(OpenflowVersion.OF13.getVersion(), MockOxmClassBase.class, MockMatchField1.class);
+    private static final MatchEntrySerializerKey<? extends OxmClassBase, ? extends MatchField> KEY_2 =
+        new MatchEntrySerializerKey<>(OpenflowVersion.OF13.getVersion(), MockOxmClassBase.class, MockMatchField2.class);
 
     @Before
     public void setup() {
         OFSessionUtil.getSessionManager().setExtensionConverterProvider(extensionConverterProvider);
-        when(extensionConverterProvider.getConverter(KEY))
-            .thenReturn((input, path) -> {
-                MockAugmentation mockAugmentation = new MockAugmentation();
-                return new ExtensionAugment<>(MockAugmentation.class, mockAugmentation, MockExtensionKey.class);
-            });
+        when(extensionConverterProvider.getConverter(KEY_1))
+                .thenReturn((input, path) -> {
+                    MockAugmentation mockAugmentation = new MockAugmentation();
+                    return new ExtensionAugment<>(MockAugmentation.class, mockAugmentation, MockExtensionKey1.class);
+                });
+        when(extensionConverterProvider.getConverter(KEY_2))
+                .thenReturn((input, path) -> {
+                    MockAugmentation mockAugmentation = new MockAugmentation();
+                    return new ExtensionAugment<>(MockAugmentation.class, mockAugmentation, MockExtensionKey2.class);
+                });
     }
 
 
@@ -79,14 +84,19 @@ public class MatchExtensionHelperTest {
 
 
     private static List<MatchEntry> createMatchEntrieses() {
+        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
+        matchEntryBuilder.setHasMask(true);
+        matchEntryBuilder.setOxmClass(MockOxmClassBase.class);
+        matchEntryBuilder.setOxmMatchField(MockMatchField1.class);
         List<MatchEntry> matchEntries = new ArrayList<>();
-        for (int i = 0; i < PRESET_COUNT; i++) {
-            MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
-            matchEntryBuilder.setHasMask(true);
-            matchEntryBuilder.setOxmClass(MockOxmClassBase.class);
-            matchEntryBuilder.setOxmMatchField(MockMatchField.class);
-            matchEntries.add(matchEntryBuilder.build());
-        }
+        matchEntries.add(matchEntryBuilder.build());
+
+
+        MatchEntryBuilder matchEntryBuilder1 = new MatchEntryBuilder();
+        matchEntryBuilder1.setHasMask(true);
+        matchEntryBuilder1.setOxmClass(MockOxmClassBase.class);
+        matchEntryBuilder1.setOxmMatchField(MockMatchField2.class);
+        matchEntries.add(matchEntryBuilder1.build());
         return matchEntries;
     }
 
@@ -94,15 +104,24 @@ public class MatchExtensionHelperTest {
 
     }
 
-    private interface MockMatchField extends MatchField {
+    private class MockMatchField1 implements MatchField {
+    }
+
+    private class MockMatchField2 implements MatchField {
+    }
+
+    private interface MockExtensionKey1 extends ExtensionKey {
 
     }
 
-    private interface MockExtensionKey extends ExtensionKey {
+    private interface MockExtensionKey2 extends ExtensionKey {
 
     }
 
     private final class MockAugmentation implements Augmentation<Extension> {
-
+        @Override
+        public Class<MockAugmentation> implementedInterface() {
+            return MockAugmentation.class;
+        }
     }
 }
index 4caf09709d8c5c0bd9ba926a56e500fa67280abe..a4f291f71a6d018ba7fc59d112a2a5d5400d1a5a 100644 (file)
@@ -40,6 +40,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
@@ -102,6 +103,7 @@ public class GroupConvertorTest {
         bucketB.setWeight(10);
         bucketB.setWatchPort(20L);
         bucketB.setWatchGroup(22L);
+        bucketB.withKey(new BucketKey(new BucketId(Uint32.ZERO)));
 
         bucketB.setAction(actionsList);
         final Bucket bucket = bucketB.build();
@@ -112,6 +114,7 @@ public class GroupConvertorTest {
         bucketB1.setWeight(50);
         bucketB1.setWatchPort(60L);
         bucketB1.setWatchGroup(70L);
+        bucketB1.withKey(new BucketKey(new BucketId(Uint32.ONE)));
 
         // Action1
         final CopyTtlInBuilder copyTtlB = new CopyTtlInBuilder();
@@ -231,7 +234,7 @@ public class GroupConvertorTest {
 
         final BucketBuilder bucketB = new BucketBuilder();
 
-        bucketB.setAction(actionsList);
+        bucketB.setAction(actionsList).withKey(new BucketKey(new BucketId(Uint32.ZERO)));
         final Bucket bucket = bucketB.build();
 
         bucketList.add(bucket); // List of bucket
@@ -244,7 +247,7 @@ public class GroupConvertorTest {
         // Action2:
         actionsList1.add(assembleSetMplsTtlActionBuilder(actionOrder++).build());
 
-        bucketB1.setAction(actionsList1);
+        bucketB1.setAction(actionsList1).withKey(new BucketKey(new BucketId(Uint32.ONE)));
 
         final Bucket bucket1 = bucketB1.build(); // second bucket
 
@@ -459,7 +462,7 @@ public class GroupConvertorTest {
 
         final BucketBuilder bucketB = new BucketBuilder();
 
-        bucketB.setAction(actionsList);
+        bucketB.setAction(actionsList).withKey(new BucketKey(new BucketId(Uint32.ZERO)));
         final Bucket bucket = bucketB.build();
 
         bucketList.add(bucket); // List of bucket
@@ -471,7 +474,7 @@ public class GroupConvertorTest {
         // Action2:
         actionsList1.add(assembleSetMplsTtlActionBuilder(actionOrder++).build());
 
-        bucketB1.setAction(actionsList);
+        bucketB1.setAction(actionsList).withKey(new BucketKey(new BucketId(Uint32.ONE)));
 
         final Bucket bucket1 = bucketB1.build(); // second bucket
 
index 48d171ab7d6d3cbf213a31c774f56244f807fc3f..6e51f5d770a55c996b3ea425b313e2d3d121173b 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Optional;
 import org.junit.Assert;
@@ -79,7 +80,7 @@ public class GroupDescStatsResponseConvertorTest {
         Assert.assertEquals("Wrong type", GroupTypes.GroupAll, stat.getGroupType());
         Assert.assertEquals("Wrong group-id", 42, stat.getGroupId().getValue().intValue());
         Assert.assertEquals("Wrong key", 42, stat.key().getGroupId().getValue().intValue());
-        Assert.assertEquals("Wrong buckets size", 0, stat.getBuckets().getBucket().size());
+        Assert.assertEquals("Wrong buckets size", 0, stat.getBuckets().nonnullBucket().size());
     }
 
     /**
@@ -179,10 +180,11 @@ public class GroupDescStatsResponseConvertorTest {
         Assert.assertEquals("Wrong type", GroupTypes.GroupFf, stat.getGroupType());
         Assert.assertEquals("Wrong group-id", 42, stat.getGroupId().getValue().intValue());
         Assert.assertEquals("Wrong key", 42, stat.key().getGroupId().getValue().intValue());
-        Assert.assertEquals("Wrong buckets size", 1, stat.getBuckets().getBucket().size());
+        Assert.assertEquals("Wrong buckets size", 1, stat.getBuckets().nonnullBucket().size());
 
         // Test first bucket for first group desc
-        Bucket bucket = stat.getBuckets().getBucket().get(0);
+        Iterator<Bucket> bucketIt = stat.getBuckets().nonnullBucket().values().iterator();
+        Bucket bucket = bucketIt.next();
         Assert.assertEquals("Wrong type", 0, bucket.key().getBucketId().getValue().intValue());
         Assert.assertEquals("Wrong type", 0, bucket.getBucketId().getValue().intValue());
         Assert.assertEquals("Wrong type", 16, bucket.getWeight().intValue());
@@ -192,7 +194,7 @@ public class GroupDescStatsResponseConvertorTest {
 
         // Test first action for first bucket for first group desc
         org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list
-                .Action action = bucket.getAction().get(0);
+                .Action action = bucket.nonnullAction().values().iterator().next();
         Assert.assertEquals("Wrong type", 0, action.getOrder().intValue());
         Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112"
                 + ".action.action.CopyTtlInCase", action.getAction().implementedInterface().getName());
@@ -204,43 +206,45 @@ public class GroupDescStatsResponseConvertorTest {
         Assert.assertEquals("Wrong type", GroupTypes.GroupIndirect, stat.getGroupType());
         Assert.assertEquals("Wrong group-id", 50, stat.getGroupId().getValue().intValue());
         Assert.assertEquals("Wrong key", 50, stat.key().getGroupId().getValue().intValue());
-        Assert.assertEquals("Wrong buckets size", 2, stat.getBuckets().getBucket().size());
+        Assert.assertEquals("Wrong buckets size", 2, stat.getBuckets().nonnullBucket().size());
 
         // Test first bucket for second group desc
-        bucket = stat.getBuckets().getBucket().get(0);
+        bucketIt = stat.getBuckets().nonnullBucket().values().iterator();
+        bucket = bucketIt.next();
         Assert.assertEquals("Wrong type", 0, bucket.key().getBucketId().getValue().intValue());
         Assert.assertEquals("Wrong type", 0, bucket.getBucketId().getValue().intValue());
         Assert.assertEquals("Wrong type", 100, bucket.getWeight().intValue());
         Assert.assertEquals("Wrong type", 400, bucket.getWatchGroup().intValue());
         Assert.assertEquals("Wrong type", 200, bucket.getWatchPort().intValue());
-        Assert.assertEquals("Wrong type", 3, bucket.getAction().size());
+        Assert.assertEquals("Wrong type", 3, bucket.nonnullAction().size());
 
         // Test first action for first bucket of second group desc
-        action = bucket.getAction().get(0);
+        var actionIt = bucket.nonnullAction().values().iterator();
+        action = actionIt.next();
         Assert.assertEquals("Wrong type", 0, action.getOrder().intValue());
         Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112"
                 + ".action.action.CopyTtlOutCase", action.getAction().implementedInterface().getName());
 
         // Test second action for first bucket of second group desc
-        action = bucket.getAction().get(1);
+        action = actionIt.next();
         Assert.assertEquals("Wrong type", 1, action.getOrder().intValue());
         Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112"
                 + ".action.action.DecNwTtlCase", action.getAction().implementedInterface().getName());
 
         // Test third action for first bucket of second group desc
-        action = bucket.getAction().get(2);
+        action = actionIt.next();
         Assert.assertEquals("Wrong type", 2, action.getOrder().intValue());
         Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112"
                 + ".action.action.PopPbbActionCase", action.getAction().implementedInterface().getName());
 
         // Test second bucket for second group desc
-        bucket = stat.getBuckets().getBucket().get(1);
+        bucket = bucketIt.next();
         Assert.assertEquals("Wrong type", 1, bucket.key().getBucketId().getValue().intValue());
         Assert.assertEquals("Wrong type", 1, bucket.getBucketId().getValue().intValue());
         Assert.assertEquals("Wrong type", 5, bucket.getWeight().intValue());
         Assert.assertEquals("Wrong type", 15, bucket.getWatchGroup().intValue());
         Assert.assertEquals("Wrong type", 10, bucket.getWatchPort().intValue());
-        Assert.assertEquals("Wrong type", 0, bucket.getAction().size());
+        Assert.assertEquals("Wrong type", 0, bucket.nonnullAction().size());
     }
 
     private List<GroupDescStats> convert(List<GroupDesc> groupDescStats,VersionConvertorData data) {
index 5f065b3df274780da76685a7087e431782fc190a..48b7c16ed445a38e6628305c971058409cc91583 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
 
 import java.math.BigInteger;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Optional;
 import org.junit.Assert;
@@ -83,7 +84,7 @@ public class GroupStatsResponseConvertorTest {
         Assert.assertEquals("Wrong byte count", 12345, stat.getByteCount().getValue().intValue());
         Assert.assertEquals("Wrong duration sec", 5000, stat.getDuration().getSecond().getValue().intValue());
         Assert.assertEquals("Wrong duration n sec", 1000000, stat.getDuration().getNanosecond().getValue().intValue());
-        Assert.assertEquals("Wrong bucket stats", 0, stat.getBuckets().getBucketCounter().size());
+        Assert.assertEquals("Wrong bucket stats", 0, stat.getBuckets().nonnullBucketCounter().size());
     }
 
     /**
@@ -129,7 +130,7 @@ public class GroupStatsResponseConvertorTest {
         Assert.assertEquals("Wrong byte count", 12345, stat.getByteCount().getValue().intValue());
         Assert.assertEquals("Wrong duration sec", 5000, stat.getDuration().getSecond().getValue().intValue());
         Assert.assertEquals("Wrong duration n sec", 1000000, stat.getDuration().getNanosecond().getValue().intValue());
-        Assert.assertEquals("Wrong bucket stats", 0, stat.getBuckets().getBucketCounter().size());
+        Assert.assertEquals("Wrong bucket stats", 0, stat.getBuckets().nonnullBucketCounter().size());
         stat = salGroupStats.get(1);
         Assert.assertEquals("Wrong group-id", 4, stat.getGroupId().getValue().intValue());
         Assert.assertEquals("Wrong key", 4, stat.key().getGroupId().getValue().intValue());
@@ -138,7 +139,7 @@ public class GroupStatsResponseConvertorTest {
         Assert.assertEquals("Wrong byte count", 1, stat.getByteCount().getValue().intValue());
         Assert.assertEquals("Wrong duration sec", 3, stat.getDuration().getSecond().getValue().intValue());
         Assert.assertEquals("Wrong duration n sec", 2, stat.getDuration().getNanosecond().getValue().intValue());
-        Assert.assertEquals("Wrong bucket stats", 0, stat.getBuckets().getBucketCounter().size());
+        Assert.assertEquals("Wrong bucket stats", 0, stat.getBuckets().nonnullBucketCounter().size());
     }
 
     /**
@@ -184,12 +185,14 @@ public class GroupStatsResponseConvertorTest {
         Assert.assertEquals("Wrong duration sec", 5000, stat.getDuration().getSecond().getValue().intValue());
         Assert.assertEquals("Wrong duration n sec", 1000000, stat.getDuration().getNanosecond().getValue().intValue());
         Assert.assertEquals("Wrong bucket stats", 2, stat.getBuckets().getBucketCounter().size());
-        List<BucketCounter> list = stat.getBuckets().getBucketCounter();
-        Assert.assertEquals("Wrong bucket-id", 0, list.get(0).getBucketId().getValue().intValue());
-        Assert.assertEquals("Wrong bucket packet count", 654, list.get(0).getPacketCount().getValue().intValue());
-        Assert.assertEquals("Wrong bucket byte count", 987, list.get(0).getByteCount().getValue().intValue());
-        Assert.assertEquals("Wrong bucket-id", 1, list.get(1).getBucketId().getValue().intValue());
-        Assert.assertEquals("Wrong bucket packet count", 456, list.get(1).getPacketCount().getValue().intValue());
-        Assert.assertEquals("Wrong bucket byte count", 123, list.get(1).getByteCount().getValue().intValue());
+        Iterator<BucketCounter> it = stat.getBuckets().nonnullBucketCounter().values().iterator();
+        BucketCounter counter = it.next();
+        Assert.assertEquals("Wrong bucket-id", 0, counter.getBucketId().getValue().intValue());
+        Assert.assertEquals("Wrong bucket packet count", 654, counter.getPacketCount().getValue().intValue());
+        Assert.assertEquals("Wrong bucket byte count", 987, counter.getByteCount().getValue().intValue());
+        counter = it.next();
+        Assert.assertEquals("Wrong bucket-id", 1, counter.getBucketId().getValue().intValue());
+        Assert.assertEquals("Wrong bucket packet count", 456, counter.getPacketCount().getValue().intValue());
+        Assert.assertEquals("Wrong bucket byte count", 123, counter.getByteCount().getValue().intValue());
     }
 }
index cfc09ce8d59d781d3c7f54085b81c26541039b78..f35904150be9abe85f98332e7ac3291aa250cf59 100644 (file)
@@ -19,6 +19,7 @@ import org.junit.Test;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.BandId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterBandType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterFlags;
@@ -32,6 +33,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.MeterBandHeadersBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeader;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeaderBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeaderKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.meter.band.header.MeterBandTypesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdMeterBand;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterModCommand;
@@ -69,6 +71,7 @@ public class MeterConvertorTest {
         MeterBandHeaderBuilder meterBandHeaderBuilder = new MeterBandHeaderBuilder();
         meterBandHeaderBuilder.setBandType(drp);
         meterBandHeaderBuilder.setMeterBandTypes(meterBandTypesB.build());
+        meterBandHeaderBuilder.withKey(new MeterBandHeaderKey(new BandId(Uint32.ZERO)));
 
         final MeterBandHeader meterBH = meterBandHeaderBuilder.build();
 
@@ -90,6 +93,7 @@ public class MeterConvertorTest {
         MeterBandHeaderBuilder meterBandHeaderBuilder1 = new MeterBandHeaderBuilder();
         meterBandHeaderBuilder1.setBandType(dscpRemark);
         meterBandHeaderBuilder1.setMeterBandTypes(meterBandTypesB1.build());
+        meterBandHeaderBuilder1.withKey(new MeterBandHeaderKey(new BandId(Uint32.ONE)));
 
         final MeterBandHeader meterBH1 = meterBandHeaderBuilder1.build();
 
@@ -111,6 +115,7 @@ public class MeterConvertorTest {
         MeterBandHeaderBuilder meterBandHeaderBuilder2 = new MeterBandHeaderBuilder();
         meterBandHeaderBuilder2.setBandType(experimenter);
         meterBandHeaderBuilder2.setMeterBandTypes(meterBandTypesB2.build());
+        meterBandHeaderBuilder.withKey(new MeterBandHeaderKey(new BandId(Uint32.TWO)));
         MeterBandHeader meterBH2 = meterBandHeaderBuilder2.build();
 
         List<MeterBandHeader> meterBandList = new ArrayList<>();
@@ -200,6 +205,7 @@ public class MeterConvertorTest {
         MeterBandHeaderBuilder meterBandHeaderBuilder = new MeterBandHeaderBuilder();
         meterBandHeaderBuilder.setBandType(drp);
         meterBandHeaderBuilder.setMeterBandTypes(meterBandTypesB.build());
+        meterBandHeaderBuilder.withKey(new MeterBandHeaderKey(new BandId(Uint32.ZERO)));
 
         final MeterBandHeader meterBH = meterBandHeaderBuilder.build();
 
@@ -222,6 +228,7 @@ public class MeterConvertorTest {
         MeterBandHeaderBuilder meterBandHeaderBuilder1 = new MeterBandHeaderBuilder();
         meterBandHeaderBuilder1.setBandType(dscpRemark);
         meterBandHeaderBuilder1.setMeterBandTypes(meterBandTypesB1.build());
+        meterBandHeaderBuilder1.withKey(new MeterBandHeaderKey(new BandId(Uint32.ONE)));
 
         final MeterBandHeader meterBH1 = meterBandHeaderBuilder1.build();
 
@@ -244,6 +251,7 @@ public class MeterConvertorTest {
         MeterBandHeaderBuilder meterBandHeaderBuilder2 = new MeterBandHeaderBuilder();
         meterBandHeaderBuilder2.setBandType(experimenter);
         meterBandHeaderBuilder2.setMeterBandTypes(meterBandTypesB2.build());
+        meterBandHeaderBuilder2.withKey(new MeterBandHeaderKey(new BandId(Uint32.TWO)));
         MeterBandHeader meterBH2 = meterBandHeaderBuilder2.build();
 
         List<MeterBandHeader> meterBandList = new ArrayList<>();
@@ -349,6 +357,7 @@ public class MeterConvertorTest {
         meterBandTypesB.setFlags(bandFlag);// _ofpmbtDrop
 
         meterBandHeaderBuilder.setMeterBandTypes(meterBandTypesB.build());
+        meterBandHeaderBuilder.withKey(new MeterBandHeaderKey(new BandId(Uint32.ZERO)));
 
         final MeterBandHeader meterBH = meterBandHeaderBuilder.build();
 
@@ -366,6 +375,7 @@ public class MeterConvertorTest {
         MeterBandHeaderBuilder meterBandHeaderBuilder1 = new MeterBandHeaderBuilder();
         meterBandHeaderBuilder1.setBandType(dscpRemark);
         meterBandHeaderBuilder1.setMeterBandTypes(meterBandTypesB1.build());
+        meterBandHeaderBuilder1.withKey(new MeterBandHeaderKey(new BandId(Uint32.ONE)));
 
         final MeterBandHeader meterBH1 = meterBandHeaderBuilder1.build();
 
@@ -382,6 +392,7 @@ public class MeterConvertorTest {
 
         MeterBandTypesBuilder meterBandTypesB2 = new MeterBandTypesBuilder();
         meterBandHeaderBuilder2.setMeterBandTypes(meterBandTypesB2.build());
+        meterBandHeaderBuilder2.withKey(new MeterBandHeaderKey(new BandId(Uint32.TWO)));
         MeterBandHeader meterBH2 = meterBandHeaderBuilder2.build();
 
         List<MeterBandHeader> meterBandList = new ArrayList<>();
index 853f05df098ba94d5c029d6342105c49ae355815..9d924cb8fd4ac08c39f960532a0dc5d5ae5f90dd 100644 (file)
@@ -81,9 +81,9 @@ public class MeterStatsResponseConvertorTest {
             assertEquals(Uint32.valueOf(cnt), meterStats.getFlowCount().getValue());
             assertEquals(Uint64.valueOf(cnt), meterStats.getByteInCount().getValue());
 
-            assertEquals(PRESET_COUNT, meterStats.getMeterBandStats().getBandStat().size());
+            assertEquals(PRESET_COUNT, meterStats.getMeterBandStats().nonnullBandStat().size());
             int bandStatCount = 0;
-            for (BandStat bandStat : meterStats.getMeterBandStats().getBandStat()) {
+            for (BandStat bandStat : meterStats.getMeterBandStats().nonnullBandStat().values()) {
                 assertEquals(Uint64.valueOf(bandStatCount), bandStat.getByteBandCount().getValue());
                 assertEquals(Uint64.valueOf(bandStatCount), bandStat.getPacketBandCount().getValue());
                 bandStatCount++;
index 7a78c11c207e742e6e0ed2bc68a599286a76a9a5..c3fc45ca8ef7cbddae038c80fde52613b4858af9 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
 
 import java.math.BigInteger;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import org.junit.Assert;
@@ -70,8 +69,6 @@ public class PacketOutConvertorTest {
 
         TransmitPacketInputBuilder transmitPacketInputBuilder = new TransmitPacketInputBuilder();
 
-        Long bufferId = null;
-
         String nodeId = "0";
         String port = "0";
 
@@ -80,9 +77,8 @@ public class PacketOutConvertorTest {
         NodeConnectorRef egressConfRef = new NodeConnectorRef(
                 createNodeConnRef(nodeId, nodeConnKey));
 
-        transmitPacketInputBuilder.setBufferId(bufferId);
+        transmitPacketInputBuilder.setBufferId((Uint32) null);
         transmitPacketInputBuilder.setConnectionCookie(null);
-        transmitPacketInputBuilder.setAction(null);
         transmitPacketInputBuilder.setNode(ref);
         transmitPacketInputBuilder.setPayload(null);
         transmitPacketInputBuilder.setEgress(egressConfRef);
@@ -185,7 +181,7 @@ public class PacketOutConvertorTest {
 
         Optional<List<Action>> actionsOptional = convertorManager.convert(actionList, actionConvertorData);
 
-        List<Action> actions = actionsOptional.orElse(Collections.emptyList());
+        List<Action> actions = actionsOptional.orElse(null);
         Assert.assertEquals(actions, message.getAction());
         Assert.assertArrayEquals(transmitPacketInput.getPayload(), message.getData());
     }
index 4b96254de60b0acbe972b33779f5f27e9cd2f3c2..1bc75a1445700a9468672237afcc3d494ee3bd16 100644 (file)
@@ -13,6 +13,7 @@ import static org.junit.Assert.assertNotNull;
 
 import java.math.BigInteger;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -84,6 +85,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey;
 
 public class TableFeaturesConvertorTest {
     private static final TablePropertiesBuilder TABLE_PROPERTIES_BUILDER = new TablePropertiesBuilder();
@@ -106,6 +108,7 @@ public class TableFeaturesConvertorTest {
     }
 
     private static void setupFieldTableFeatures() {
+        int order = 0;
         SetFieldMatchBuilder setFieldMatchBuilder = new SetFieldMatchBuilder();
         setFieldMatchBuilder.setHasMask(true);
         setFieldMatchBuilder
@@ -220,7 +223,7 @@ public class TableFeaturesConvertorTest {
                 .setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst.class);
         FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
         setFieldMatchBuilder
-                .setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst.class);
+                .setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpSrc.class);
         FIELD_TABLE_FEATURES.add(setFieldMatchBuilder.build());
         setFieldMatchBuilder
                 .setMatchType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanPcp.class);
@@ -243,53 +246,54 @@ public class TableFeaturesConvertorTest {
         org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder actionBuilder =
                 new ActionBuilder();
 
+        int order = 0;
         OutputActionCaseBuilder outputActionCaseBuilder = new OutputActionCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(outputActionCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(outputActionCaseBuilder.build()).build());
 
         GroupActionCaseBuilder groupActionCaseBuilder = new GroupActionCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(groupActionCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(groupActionCaseBuilder.build()).build());
 
         CopyTtlOutCaseBuilder copyTtlOutCaseBuilder = new CopyTtlOutCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(copyTtlOutCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(copyTtlOutCaseBuilder.build()).build());
 
         CopyTtlInCaseBuilder copyTtlInCaseBuilder = new CopyTtlInCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(copyTtlInCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(copyTtlInCaseBuilder.build()).build());
 
         SetMplsTtlActionCaseBuilder setMplsTtlActionCaseBuilder = new SetMplsTtlActionCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(setMplsTtlActionCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(setMplsTtlActionCaseBuilder.build()).build());
 
         DecMplsTtlCaseBuilder decMplsTtlCaseBuilder = new DecMplsTtlCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(decMplsTtlCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(decMplsTtlCaseBuilder.build()).build());
 
         PushVlanActionCaseBuilder pushVlanActionCaseBuilder = new PushVlanActionCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(pushVlanActionCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(pushVlanActionCaseBuilder.build()).build());
 
         PopVlanActionCaseBuilder popVlanActionCaseBuilder = new PopVlanActionCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(popVlanActionCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(popVlanActionCaseBuilder.build()).build());
 
         PushMplsActionCaseBuilder pushMplsActionCaseBuilder = new PushMplsActionCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(pushMplsActionCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(pushMplsActionCaseBuilder.build()).build());
 
         PopMplsActionCaseBuilder popMplsActionCaseBuilder = new PopMplsActionCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(popMplsActionCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(popMplsActionCaseBuilder.build()).build());
 
         SetQueueActionCaseBuilder setQueueActionCaseBuilder = new SetQueueActionCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(setQueueActionCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(setQueueActionCaseBuilder.build()).build());
 
         SetNwTtlActionCaseBuilder setNwTtlActionCaseBuilder = new SetNwTtlActionCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(setNwTtlActionCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(setNwTtlActionCaseBuilder.build()).build());
 
         DecNwTtlCaseBuilder decNwTtlCaseBuilder = new DecNwTtlCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(decNwTtlCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(decNwTtlCaseBuilder.build()).build());
 
         SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(setFieldCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(setFieldCaseBuilder.build()).build());
 
         PushPbbActionCaseBuilder pushPbbActionCaseBuilder = new PushPbbActionCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(pushPbbActionCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(pushPbbActionCaseBuilder.build()).build());
 
         PopPbbActionCaseBuilder popPbbActionCaseBuilder = new PopPbbActionCaseBuilder();
-        ACTIONS.add(actionBuilder.setAction(popPbbActionCaseBuilder.build()).build());
+        ACTIONS.add(actionBuilder.setOrder(order++).setAction(popPbbActionCaseBuilder.build()).build());
 
     }
 
@@ -300,10 +304,11 @@ public class TableFeaturesConvertorTest {
         setupFieldTableFeatures();
         InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
         List<Instruction> instructions = new ArrayList<>();
-        for (int i = 0; i < INSTRUCTIONS_LIST.size(); i++) {
-            InstructionBuilder instructionBuilder = new InstructionBuilder();
-            instructionBuilder.setInstruction(INSTRUCTIONS_LIST.get(i));
-            instructions.add(instructionBuilder.build());
+        int order = 0;
+        for (var element : INSTRUCTIONS_LIST) {
+            instructions.add(new InstructionBuilder()
+                .setOrder(order++)
+                .setInstruction(element).build());
         }
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature
             .prop.type.instructions.InstructionsBuilder instructionsBuilder1 =
@@ -403,19 +408,18 @@ public class TableFeaturesConvertorTest {
 
         assertNotNull(tableFeatures);
         assertEquals(10, tableFeatures.getTableFeatures().size());
-        List<TableFeatureProperties> tableFeaturePropertieses = tableFeatures.getTableFeatures().get(0)
-                .getTableProperties().getTableFeatureProperties();
+        Collection<TableFeatureProperties> tableFeaturePropertieses = tableFeatures.nonnullTableFeatures().values()
+                .iterator().next().getTableProperties().nonnullTableFeatureProperties().values();
         assertEquals(AUGMENTATIONS_MAP.size() + 1, tableFeaturePropertieses.size());
 
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature
             .prop.type.ApplyActionsMiss applyActionsMiss = null;
-        for (int i = 0; i < tableFeaturePropertieses.size(); i++) {
-            if (tableFeaturePropertieses.get(i).getTableFeaturePropType().implementedInterface().isAssignableFrom(
-                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table
-                        .feature.prop.type.ApplyActionsMiss.class)) {
+        for (var featureProp : tableFeaturePropertieses) {
+            var prop = featureProp.getTableFeaturePropType();
+            if (prop.implementedInterface().isAssignableFrom(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types
+                    .rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss.class)) {
                 applyActionsMiss = (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature
-                    .prop.type.table.feature.prop.type.ApplyActionsMiss) tableFeaturePropertieses.get(i)
-                        .getTableFeaturePropType();
+                    .prop.type.table.feature.prop.type.ApplyActionsMiss) prop;
                 break;
             }
         }
@@ -429,13 +433,16 @@ public class TableFeaturesConvertorTest {
         TableFeaturePropertiesBuilder tableFeaturePropertiesBuilder = new TableFeaturePropertiesBuilder();
         List<TableFeatureProperties> tableFeaturePropertieses = new ArrayList<>();
         int counter = 0;
+        int order = 0;
         for (Entry<Class<? extends TableFeaturePropType>, TableFeaturePropType> entry : AUGMENTATIONS_MAP.entrySet()) {
             counter++;
             tableFeaturePropertiesBuilder.setTableFeaturePropType(entry.getValue());
             tableFeaturePropertiesBuilder.setOrder(counter);
+            tableFeaturePropertiesBuilder.withKey(new TableFeaturePropertiesKey(order++));
             tableFeaturePropertieses.add(tableFeaturePropertiesBuilder.build());
         }
-        tableFeaturePropertieses.add(tableFeaturePropertiesBuilder.build());
+        tableFeaturePropertieses.add(
+                tableFeaturePropertiesBuilder.withKey(new TableFeaturePropertiesKey(order++)).build());
         TABLE_PROPERTIES_BUILDER.setTableFeatureProperties(tableFeaturePropertieses);
         return TABLE_PROPERTIES_BUILDER.build();
     }
index 7e8be640a350efc49fa64fb038a1dc6eba1fd935..f7ac01471f89a70208d92b9359248b515d30e051 100644 (file)
@@ -9,7 +9,9 @@
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Optional;
 import org.junit.Assert;
@@ -170,7 +172,7 @@ public class TableFeaturesResponseConvertorTest {
         Assert.assertEquals("Wrong metadata write", Uint64.valueOf("08090A0B0C0D0E0F", 16), feature.getMetadataWrite());
         Assert.assertEquals("Wrong config", false, feature.getConfig().isDEPRECATEDMASK());
         Assert.assertEquals("Wrong max-entries", 42, feature.getMaxEntries().intValue());
-        Assert.assertEquals("Wrong properties", 0, feature.getTableProperties().getTableFeatureProperties().size());
+        Assert.assertEquals("Wrong properties", 0, feature.getTableProperties().nonnullTableFeatureProperties().size());
     }
 
     /**
@@ -555,10 +557,11 @@ public class TableFeaturesResponseConvertorTest {
         Assert.assertEquals("Wrong metadata write",Uint64.valueOf("08090A0B0C0D0E0F", 16), feature.getMetadataWrite());
         Assert.assertEquals("Wrong config", false, feature.getConfig().isDEPRECATEDMASK());
         Assert.assertEquals("Wrong max-entries", 42, feature.getMaxEntries().intValue());
-        Assert.assertEquals("Wrong properties", 4, feature.getTableProperties().getTableFeatureProperties().size());
+        Assert.assertEquals("Wrong properties", 4, feature.getTableProperties().nonnullTableFeatureProperties().size());
+
+        var featProps = feature.getTableProperties().getTableFeatureProperties().values().iterator();
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table
-            .properties.TableFeatureProperties property = feature.getTableProperties().getTableFeatureProperties()
-                .get(0);
+            .properties.TableFeatureProperties property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.NextTable",
                 property.getTableFeaturePropType().implementedInterface().getName());
@@ -567,7 +570,7 @@ public class TableFeaturesResponseConvertorTest {
         Assert.assertEquals("Wrong next table-id size", 2, ids.size());
         Assert.assertEquals("Wrong next-registry-id", 1, ids.get(0).intValue());
         Assert.assertEquals("Wrong next-registry-id", 2, ids.get(1).intValue());
-        property = feature.getTableProperties().getTableFeatureProperties().get(1);
+        property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.NextTableMiss",
                 property.getTableFeaturePropType().implementedInterface().getName());
@@ -576,42 +579,43 @@ public class TableFeaturesResponseConvertorTest {
         Assert.assertEquals("Wrong next table-id size", 1, ids.size());
         Assert.assertEquals("Wrong next-registry-id", 3, ids.get(0).intValue());
 
-        property = feature.getTableProperties().getTableFeatureProperties().get(2);
+        property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.Instructions",
                 property.getTableFeaturePropType().implementedInterface().getName());
         Instructions propType3 = (Instructions) property.getTableFeaturePropType();
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list
-                .Instruction> instructionIds = propType3.getInstructions().getInstruction();
+        var instructionIds = propType3.getInstructions().nonnullInstruction().values();
         Assert.assertEquals("Wrong instruction-ids size", 2, instructionIds.size());
+        var instructionIt = instructionIds.iterator();
         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
             + "rev131026.instruction.instruction.WriteActionsCase",
-                instructionIds.get(0).getInstruction().implementedInterface().getName());
+            instructionIt.next().getInstruction().implementedInterface().getName());
         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
             + "rev131026.instruction.instruction.GoToTableCase",
-                instructionIds.get(1).getInstruction().implementedInterface().getName());
-        property = feature.getTableProperties().getTableFeatureProperties().get(3);
+            instructionIt.next().getInstruction().implementedInterface().getName());
+        property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMiss",
                 property.getTableFeaturePropType().implementedInterface().getName());
         InstructionsMiss propType4 = (InstructionsMiss) property.getTableFeaturePropType();
-        instructionIds = propType4.getInstructionsMiss().getInstruction();
+        instructionIds = propType4.getInstructionsMiss().nonnullInstruction().values();
         Assert.assertEquals("Wrong instruction-ids size", 5, instructionIds.size());
+        instructionIt = instructionIds.iterator();
         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
             + "rev131026.instruction.instruction.WriteMetadataCase",
-                instructionIds.get(0).getInstruction().implementedInterface().getName());
+                instructionIt.next().getInstruction().implementedInterface().getName());
         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
             + "rev131026.instruction.instruction.ApplyActionsCase",
-                instructionIds.get(1).getInstruction().implementedInterface().getName());
+                instructionIt.next().getInstruction().implementedInterface().getName());
         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
             + "rev131026.instruction.instruction.MeterCase",
-                instructionIds.get(2).getInstruction().implementedInterface().getName());
+                instructionIt.next().getInstruction().implementedInterface().getName());
         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
             + "rev131026.instruction.instruction.ClearActionsCase",
-                instructionIds.get(3).getInstruction().implementedInterface().getName());
+                instructionIt.next().getInstruction().implementedInterface().getName());
         Assert.assertEquals("Wrong instruction-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types."
             + "rev131026.instruction.instruction.GoToTableCase",
-                instructionIds.get(4).getInstruction().implementedInterface().getName());
+                instructionIt.next().getInstruction().implementedInterface().getName());
 
         feature = list.get(1);
         Assert.assertEquals("Wrong table-id", 6, feature.getTableId().intValue());
@@ -621,122 +625,130 @@ public class TableFeaturesResponseConvertorTest {
         Assert.assertEquals("Wrong config", false, feature.getConfig().isDEPRECATEDMASK());
         Assert.assertEquals("Wrong max-entries", 24, feature.getMaxEntries().intValue());
         Assert.assertEquals("Wrong properties", 12, feature.getTableProperties().getTableFeatureProperties().size());
-        property = feature.getTableProperties().getTableFeatureProperties().get(0);
+        featProps = feature.getTableProperties().nonnullTableFeatureProperties().values().iterator();
+        property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.Match",
                 property.getTableFeaturePropType().implementedInterface().getName());
         Match propType5 = (Match) property.getTableFeaturePropType();
-        List<SetFieldMatch> fieldMatch = propType5.getMatchSetfield().getSetFieldMatch();
+        Collection<SetFieldMatch> fieldMatch = propType5.getMatchSetfield().nonnullSetFieldMatch().values();
         Assert.assertEquals("Wrong match-entry-ids size", 2, fieldMatch.size());
+        Iterator<SetFieldMatch> fieldIt = fieldMatch.iterator();
         Assert.assertEquals("Wrong match-entry-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
-            + "rev131026.InPhyPort", fieldMatch.get(0).getMatchType().getName());
+            + "rev131026.InPhyPort", fieldIt.next().getMatchType().getName());
         Assert.assertEquals("Wrong match-entry-id", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
-            + "rev131026.InPort", fieldMatch.get(1).getMatchType().getName());
-        property = feature.getTableProperties().getTableFeatureProperties().get(1);
+            + "rev131026.InPort", fieldIt.next().getMatchType().getName());
+        property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfield",
                 property.getTableFeaturePropType().implementedInterface().getName());
         ApplySetfield propType6 = (ApplySetfield) property.getTableFeaturePropType();
-        fieldMatch = propType6.getApplySetfield().getSetFieldMatch();
+        fieldMatch = propType6.getApplySetfield().nonnullSetFieldMatch().values();
         Assert.assertEquals("Wrong match-entry-ids size", 2, fieldMatch.size());
+        fieldIt = fieldMatch.iterator();
         Assert.assertEquals("Wrong match-entry-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpProto",
-                fieldMatch.get(0).getMatchType().getName());
+                fieldIt.next().getMatchType().getName());
         Assert.assertEquals("Wrong match-entry-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpEcn",
-                fieldMatch.get(1).getMatchType().getName());
-        property = feature.getTableProperties().getTableFeatureProperties().get(2);
+                fieldIt.next().getMatchType().getName());
+        property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfield",
                 property.getTableFeaturePropType().implementedInterface().getName());
         WriteSetfield propType7 = (WriteSetfield) property.getTableFeaturePropType();
-        fieldMatch = propType7.getWriteSetfield().getSetFieldMatch();
+        fieldMatch = propType7.getWriteSetfield().nonnullSetFieldMatch().values();
         Assert.assertEquals("Wrong match-entry-ids size", 2, fieldMatch.size());
+        fieldIt = fieldMatch.iterator();
         Assert.assertEquals("Wrong match-entry-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Exthdr",
-                fieldMatch.get(0).getMatchType().getName());
+                fieldIt.next().getMatchType().getName());
         Assert.assertEquals("Wrong match-entry-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanVid",
-                fieldMatch.get(1).getMatchType().getName());
-        property = feature.getTableProperties().getTableFeatureProperties().get(3);
+                fieldIt.next().getMatchType().getName());
+        property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMiss",
                 property.getTableFeaturePropType().implementedInterface().getName());
         WriteSetfieldMiss propType8 = (WriteSetfieldMiss) property.getTableFeaturePropType();
-        fieldMatch = propType8.getWriteSetfieldMiss().getSetFieldMatch();
+        fieldMatch = propType8.getWriteSetfieldMiss().nonnullSetFieldMatch().values();
         Assert.assertEquals("Wrong match-entry-ids size", 2, fieldMatch.size());
+        fieldIt = fieldMatch.iterator();
         Assert.assertEquals("Wrong match-entry-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanPcp",
-                fieldMatch.get(0).getMatchType().getName());
+                fieldIt.next().getMatchType().getName());
         Assert.assertEquals("Wrong match-entry-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpSrc",
-                fieldMatch.get(1).getMatchType().getName());
-        property = feature.getTableProperties().getTableFeatureProperties().get(4);
+                fieldIt.next().getMatchType().getName());
+        property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMiss",
                 property.getTableFeaturePropType().implementedInterface().getName());
         ApplySetfieldMiss propType9 = (ApplySetfieldMiss) property.getTableFeaturePropType();
-        fieldMatch = propType9.getApplySetfieldMiss().getSetFieldMatch();
+        fieldMatch = propType9.getApplySetfieldMiss().nonnullSetFieldMatch().values();
         Assert.assertEquals("Wrong match-entry-ids size", 2, fieldMatch.size());
+        fieldIt = fieldMatch.iterator();
         Assert.assertEquals("Wrong match-entry-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpSrc",
-                fieldMatch.get(0).getMatchType().getName());
+                fieldIt.next().getMatchType().getName());
         Assert.assertEquals("Wrong match-entry-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst",
-                fieldMatch.get(1).getMatchType().getName());
-        property = feature.getTableProperties().getTableFeatureProperties().get(5);
+                fieldIt.next().getMatchType().getName());
+        property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.Wildcards",
                 property.getTableFeaturePropType().implementedInterface().getName());
         Wildcards propType10 = (Wildcards) property.getTableFeaturePropType();
-        fieldMatch = propType10.getWildcardSetfield().getSetFieldMatch();
+        fieldMatch = propType10.getWildcardSetfield().nonnullSetFieldMatch().values();
         Assert.assertEquals("Wrong match-entry-ids size", 2, fieldMatch.size());
+        fieldIt = fieldMatch.iterator();
         Assert.assertEquals("Wrong match-entry-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthSrc",
-                fieldMatch.get(0).getMatchType().getName());
+                fieldIt.next().getMatchType().getName());
         Assert.assertEquals("Wrong match-entry-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthDst",
-                fieldMatch.get(1).getMatchType().getName());
+                fieldIt.next().getMatchType().getName());
 
-        property = feature.getTableProperties().getTableFeatureProperties().get(6);
+        property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActions",
                 property.getTableFeaturePropType().implementedInterface().getName());
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
             .type.ApplyActions propType11 = (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table
                     .feature.prop.type.table.feature.prop.type.ApplyActions) property.getTableFeaturePropType();
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionsList =
-                propType11.getApplyActions().getAction();
+        var actionsList = propType11.getApplyActions().nonnullAction().values();
         Assert.assertEquals("Wrong actions-ids size", 3, actionsList.size());
+        var actionsIt = actionsList.iterator();
         Assert.assertEquals("Wrong actions-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCase",
-                actionsList.get(0).getAction().implementedInterface().getName());
+                actionsIt.next().getAction().implementedInterface().getName());
         Assert.assertEquals("Wrong actions-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCase",
-                actionsList.get(1).getAction().implementedInterface().getName());
+                actionsIt.next().getAction().implementedInterface().getName());
         Assert.assertEquals("Wrong actions-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCase",
-                actionsList.get(2).getAction().implementedInterface().getName());
+                actionsIt.next().getAction().implementedInterface().getName());
 
-        property = feature.getTableProperties().getTableFeatureProperties().get(7);
+        property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss",
                 property.getTableFeaturePropType().implementedInterface().getName());
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
             .type.ApplyActionsMiss propType12 = (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026
                 .table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss) property.getTableFeaturePropType();
-        actionsList = propType12.getApplyActionsMiss().getAction();
+        actionsList = propType12.getApplyActionsMiss().nonnullAction().values();
         Assert.assertEquals("Wrong actions-ids size", 3, actionsList.size());
+        actionsIt = actionsList.iterator();
         Assert.assertEquals("Wrong actions-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase",
-                actionsList.get(0).getAction().implementedInterface().getName());
+                actionsIt.next().getAction().implementedInterface().getName());
         Assert.assertEquals("Wrong actions-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCase",
-                actionsList.get(1).getAction().implementedInterface().getName());
+                actionsIt.next().getAction().implementedInterface().getName());
         Assert.assertEquals("Wrong actions-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCase",
-                actionsList.get(2).getAction().implementedInterface().getName());
-        property = feature.getTableProperties().getTableFeatureProperties().get(8);
+                actionsIt.next().getAction().implementedInterface().getName());
+        property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.WriteActions",
                 property.getTableFeaturePropType().implementedInterface().getName());
@@ -744,18 +756,19 @@ public class TableFeaturesResponseConvertorTest {
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
             .type.WriteActions propType13 = (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table
                 .feature.prop.type.table.feature.prop.type.WriteActions) property.getTableFeaturePropType();
-        actionsList = propType13.getWriteActions().getAction();
+        actionsList = propType13.getWriteActions().nonnullAction().values();
         Assert.assertEquals("Wrong actions-ids size", 3, actionsList.size());
+        actionsIt = actionsList.iterator();
         Assert.assertEquals("Wrong actions-id",
             "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCase",
-                actionsList.get(0).getAction().implementedInterface().getName());
+                actionsIt.next().getAction().implementedInterface().getName());
         Assert.assertEquals("Wrong actions-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCase",
-                actionsList.get(1).getAction().implementedInterface().getName());
+                actionsIt.next().getAction().implementedInterface().getName());
         Assert.assertEquals("Wrong actions-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase",
-                actionsList.get(2).getAction().implementedInterface().getName());
-        property = feature.getTableProperties().getTableFeatureProperties().get(9);
+                actionsIt.next().getAction().implementedInterface().getName());
+        property = featProps.next();
         Assert.assertEquals("Wrong property type", "org.opendaylight.yang.gen.v1.urn.opendaylight.table.types."
             + "rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMiss",
                 property.getTableFeaturePropType().implementedInterface().getName());
@@ -763,17 +776,18 @@ public class TableFeaturesResponseConvertorTest {
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
             .type.WriteActionsMiss propType14 = (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026
                 .table.feature.prop.type.table.feature.prop.type.WriteActionsMiss) property.getTableFeaturePropType();
-        actionsList = propType14.getWriteActionsMiss().getAction();
+        actionsList = propType14.getWriteActionsMiss().nonnullAction().values();
         Assert.assertEquals("Wrong actions-ids size", 3, actionsList.size());
+        actionsIt = actionsList.iterator();
         Assert.assertEquals("Wrong actions-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCase",
-                actionsList.get(0).getAction().implementedInterface().getName());
+                actionsIt.next().getAction().implementedInterface().getName());
         Assert.assertEquals("Wrong actions-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase",
-                actionsList.get(1).getAction().implementedInterface().getName());
+                actionsIt.next().getAction().implementedInterface().getName());
         Assert.assertEquals("Wrong actions-id",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase",
-                actionsList.get(2).getAction().implementedInterface().getName());
+                actionsIt.next().getAction().implementedInterface().getName());
     }
 
     private static SetNwSrcCase createSetNwSrcAction() {
index 868fc8134056604e7f83124527771ccc51350785..e8d20f28c50035f9cbda76985add5a6ebdae34dd 100644 (file)
@@ -129,7 +129,7 @@ public class FlowConvertorTest {
         Assert.assertEquals("Wrong match",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmMatchType",
                 flowMod.get(0).getMatch().getType().getName());
-        Assert.assertEquals("Wrong match entries size", 0, flowMod.get(0).getMatch().getMatchEntry().size());
+        Assert.assertEquals("Wrong match entries size", 0, flowMod.get(0).getMatch().nonnullMatchEntry().size());
     }
 
     /**
@@ -246,13 +246,13 @@ public class FlowConvertorTest {
                 + ".instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCase",
                 instruction.getInstructionChoice().implementedInterface().getName());
         WriteActionsCase writeActionsCase = (WriteActionsCase) instruction.getInstructionChoice();
-        Assert.assertEquals("Wrong actions size", 0, writeActionsCase.getWriteActions().getAction().size());
+        Assert.assertEquals("Wrong actions size", 0, writeActionsCase.getWriteActions().nonnullAction().size());
         instruction = flowMod.get(0).getInstruction().get(3);
         Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
                 + ".instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCase",
                 instruction.getInstructionChoice().implementedInterface().getName());
         ApplyActionsCase applyActionsCase =  (ApplyActionsCase) instruction.getInstructionChoice();
-        Assert.assertEquals("Wrong actions size", 0, applyActionsCase.getApplyActions().getAction().size());
+        Assert.assertEquals("Wrong actions size", 0, applyActionsCase.getApplyActions().nonnullAction().size());
         instruction = flowMod.get(0).getInstruction().get(4);
         Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
                 + ".instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCase",
index e31d4fa2d1b1f5ef047b7b23e9de422464cbf186..3e413a22dc3a412e331c706577d0f034c13139f1 100644 (file)
@@ -180,12 +180,12 @@ public class MatchResponseConvertor2Test {
     /**
      * Test {@link MatchResponseConvertor#convert(MatchEntriesGrouping, VersionDatapathIdConvertorData)}.
      */
-    @Test(expected = NullPointerException.class)
     public void testEmptyMatch() {
         final VersionDatapathIdConvertorData datapathIdConvertorData =
                 new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);
         datapathIdConvertorData.setDatapathId(Uint64.valueOf(42));
-        convert(new MatchBuilder().build(), datapathIdConvertorData);
+        // Empty null match is the same as empty match
+        Assert.assertNotNull(convert(new MatchBuilder().build(), datapathIdConvertorData));
     }
 
     /**
@@ -204,8 +204,8 @@ public class MatchResponseConvertor2Test {
                 new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);
         datapathIdConvertorData.setDatapathId(Uint64.valueOf(42));
 
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow
-                .MatchBuilder salMatch = convert(match, datapathIdConvertorData);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder salMatch =
+                convert(match, datapathIdConvertorData);
 
         final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match builtMatch =
                 salMatch.build();
index 67fe22b5df038c56d723324d221e095362743ec5..b36688edd0faf08c555bf47a144c6b8429a73258 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.mdsal</groupId>
         <artifactId>binding-parent</artifactId>
-        <version>5.0.9</version>
+        <version>6.0.0</version>
         <relativePath/>
     </parent>
 
@@ -40,8 +40,8 @@
             </dependency>
             <dependency>
                 <groupId>org.opendaylight.controller</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>1.11.0</version>
+                <artifactId>controller-artifacts</artifactId>
+                <version>2.0.0</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
index 0b44181f7e0a1de4e3df4b6f480a815f48218819..a6dd4ded3bb3fa78efe0d9199599a829e56a1583 100644 (file)
@@ -25,7 +25,7 @@ public class FlowCommitWrapperImpl implements FlowCommitWrapper {
     @Override
     public ListenableFuture<?> writeFlowToConfig(InstanceIdentifier<Flow> flowPath, Flow flowBody) {
         ReadWriteTransaction addFlowTransaction = dataBrokerService.newReadWriteTransaction();
-        addFlowTransaction.put(LogicalDatastoreType.CONFIGURATION, flowPath, flowBody, true);
+        addFlowTransaction.mergeParentStructurePut(LogicalDatastoreType.CONFIGURATION, flowPath, flowBody);
         return addFlowTransaction.commit();
     }
 
index 40b002542a82bec6b17622e43e0fde5a42034a8b..8c7b7dfc622962ed55e9f200161953401e19c5a3 100644 (file)
@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>6.0.4</version>
+        <version>7.0.1</version>
         <relativePath/>
     </parent>
 
index 358cb3b1bb1b2f83422fdb9f17ca2a9a7befab97..a300cb349cc924892ca92980923366380e153968 100644 (file)
@@ -47,8 +47,8 @@
             <artifactId>argparse4j</artifactId>
         </dependency>
         <dependency>
-            <groupId>javax.xml.bind</groupId>
-            <artifactId>jaxb-api</artifactId>
+            <groupId>jakarta.xml.bind</groupId>
+            <artifactId>jakarta.xml.bind-api</artifactId>
         </dependency>
     </dependencies>
 </project>
index 32c8a05047067e9f0de0db2e1cb8c919d16cc008..82fedc5a0cc13521676013165e615c28135f2ea5 100644 (file)
@@ -109,7 +109,7 @@ public class DropTestCommiter extends AbstractDropTest {
         if (LOG.isDebugEnabled()) {
             LOG.debug("onPacketReceived - About to write flow {}", flow);
         }
-        transaction.put(LogicalDatastoreType.CONFIGURATION, flowInstanceId, flow, true);
+        transaction.mergeParentStructurePut(LogicalDatastoreType.CONFIGURATION, flowInstanceId, flow);
         transaction.commit();
         LOG.debug("onPacketReceived - About to write flow commited");
     }
index e183029cf8509f69ad3e5ad76b5fe40db4cd91f2..bfc7e90de17283dc957bfcc8eeb6c8323529911a 100644 (file)
@@ -705,14 +705,16 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid
         InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class)
                 .child(Node.class, testNode12.key()).augmentation(FlowCapableNode.class)
                 .child(Group.class, new GroupKey(group.getGroupId()));
-        modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode12), testNode12, true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, path1, group, true);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode12),
+                testNode12);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path1, group);
 
         InstanceIdentifier<Group> path2 = InstanceIdentifier.create(Nodes.class)
                 .child(Node.class, testNode12.key()).augmentation(FlowCapableNode.class)
                 .child(Group.class, new GroupKey(group1.getGroupId()));
-        modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode12), testNode12, true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, path2, group1, true);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode12),
+                testNode12);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path2, group1);
         modification.commit().addCallback(new FutureCallback<Object>() {
             @Override
             public void onSuccess(Object notUsed) {
index 6c2c130012bc36e648837cb3a82fdd811b819552..6cf574b7203524701336f3ce9337c87519c41e96 100644 (file)
@@ -668,41 +668,41 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider {
         InstanceIdentifier<Flow> path1 = InstanceIdentifier.create(Nodes.class)
                 .child(Node.class, nodeBuilder.key()).augmentation(FlowCapableNode.class)
                 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.key());
-        modification.merge(LogicalDatastoreType.OPERATIONAL, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build(),
-                true);
-        modification.merge(LogicalDatastoreType.OPERATIONAL, path1, flow.build(), true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder),
-                nodeBuilder.build(), true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, path1, flow.build(), true);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.OPERATIONAL, nodeBuilderToInstanceId(nodeBuilder),
+                nodeBuilder.build());
+        modification.mergeParentStructureMerge(LogicalDatastoreType.OPERATIONAL, path1, flow.build());
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder),
+                nodeBuilder.build());
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path1, flow.build());
         InstanceIdentifier<Flow> path2 = InstanceIdentifier.create(Nodes.class)
                 .child(Node.class, nodeBuilder.key()).augmentation(FlowCapableNode.class)
                 .child(Table.class, new TableKey(flow1.getTableId())).child(Flow.class, flow1.key());
-        modification.merge(LogicalDatastoreType.OPERATIONAL, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build(),
-                true);
-        modification.merge(LogicalDatastoreType.OPERATIONAL, path2, flow1.build(), true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder),
-                nodeBuilder.build(), true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, path2, flow1.build(), true);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.OPERATIONAL, nodeBuilderToInstanceId(nodeBuilder),
+                nodeBuilder.build());
+        modification.mergeParentStructureMerge(LogicalDatastoreType.OPERATIONAL, path2, flow1.build());
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder),
+                nodeBuilder.build());
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path2, flow1.build());
 
         InstanceIdentifier<Flow> path3 = InstanceIdentifier.create(Nodes.class)
                 .child(Node.class, nodeBuilder.key()).augmentation(FlowCapableNode.class)
                 .child(Table.class, new TableKey(flow2.getTableId())).child(Flow.class, flow2.key());
-        modification.merge(LogicalDatastoreType.OPERATIONAL, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build(),
-                true);
-        modification.merge(LogicalDatastoreType.OPERATIONAL, path3, flow2.build(), true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder),
-                nodeBuilder.build(), true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, path3, flow2.build(), true);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.OPERATIONAL, nodeBuilderToInstanceId(nodeBuilder),
+                nodeBuilder.build());
+        modification.mergeParentStructureMerge(LogicalDatastoreType.OPERATIONAL, path3, flow2.build());
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder),
+                nodeBuilder.build());
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path3, flow2.build());
 
         InstanceIdentifier<Flow> path4 = InstanceIdentifier.create(Nodes.class)
                 .child(Node.class, nodeBuilder.key()).augmentation(FlowCapableNode.class)
                 .child(Table.class, new TableKey(flow3.getTableId())).child(Flow.class, flow3.key());
-        modification.merge(LogicalDatastoreType.OPERATIONAL, nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build(),
-                true);
-        modification.merge(LogicalDatastoreType.OPERATIONAL, path4, flow3.build(), true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder),
-                nodeBuilder.build(), true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, path4, flow3.build(), true);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.OPERATIONAL, nodeBuilderToInstanceId(nodeBuilder),
+                nodeBuilder.build());
+        modification.mergeParentStructureMerge(LogicalDatastoreType.OPERATIONAL, path4, flow3.build());
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder),
+                nodeBuilder.build());
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path4, flow3.build());
         modification.commit().addCallback(new FutureCallback<Object>() {
             @Override
             public void onSuccess(Object notUsed) {
index 2c47a55b8aad9e3294cf98ac270202b7bc62d182..03226cecd3b4f07b1c0ad3ed3aaa5cb0ecfce60c 100644 (file)
@@ -11,6 +11,7 @@ import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import org.eclipse.osgi.framework.console.CommandInterpreter;
 import org.eclipse.osgi.framework.console.CommandProvider;
@@ -209,7 +210,7 @@ public class OpenflowpluginGroupTestCommandProvider implements CommandProvider {
                 bucket.setAction(createInportOutputAction());
                 break;
             case "a24":
-                bucket.setAction(null);
+                bucket.setAction(Collections.EMPTY_LIST);
                 break;
             case "a25":
                 bucket.setAction(createNonAppyOutputAction());
@@ -613,8 +614,9 @@ public class OpenflowpluginGroupTestCommandProvider implements CommandProvider {
         InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class)
                 .child(Node.class, testNode.key()).augmentation(FlowCapableNode.class)
                 .child(Group.class, new GroupKey(group.getGroupId()));
-        modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, path1, group, true);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode),
+                testNode);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path1, group);
         modification.commit().addCallback(new FutureCallback<Object>() {
             @Override
             public void onSuccess(Object notUsed) {
index 98f9aa22c674d240fcbf19172a5274c469e9342a..f385405a12c64487223db3cd487ea91ba9b8230e 100644 (file)
@@ -377,8 +377,9 @@ public class OpenflowpluginMeterTestCommandProvider implements CommandProvider {
         ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
         InstanceIdentifier<Meter> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.key())
                 .augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(meter.getMeterId()));
-        modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, path1, meter, true);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode),
+                testNode);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path1, meter);
         modification.commit().addCallback(new FutureCallback<Object>() {
             @Override
             public void onSuccess(Object notUsed) {
@@ -396,12 +397,14 @@ public class OpenflowpluginMeterTestCommandProvider implements CommandProvider {
         ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
         InstanceIdentifier<Meter> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.key())
                 .augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(meter.getMeterId()));
-        modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, path1, meter, true);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode),
+                testNode);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path1, meter);
         InstanceIdentifier<Meter> path2 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.key())
                 .augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(meter1.getMeterId()));
-        modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, path2, meter1, true);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode),
+                testNode);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path2, meter1);
 
         modification.commit().addCallback(new FutureCallback<Object>() {
             @Override
index 3c04d436f252ad47f756f94c300f602d7f3076d7..f598e1f3a90288bc630a2b7a69a2b03de827eac5 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.openflowplugin.test;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import java.util.List;
+import java.util.Collection;
 import org.eclipse.osgi.framework.console.CommandInterpreter;
 import org.eclipse.osgi.framework.console.CommandProvider;
 import org.opendaylight.mdsal.binding.api.DataBroker;
@@ -61,7 +61,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
     public void _portStats(CommandInterpreter ci) {
         int nodeConnectorCount = 0;
         int nodeConnectorStatsCount = 0;
-        List<Node> nodes = getNodes();
+        Collection<Node> nodes = getNodes();
         for (Node node2 : nodes) {
             NodeKey nodeKey = node2.key();
             InstanceIdentifier<Node> nodeRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey);
@@ -69,7 +69,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
             Node node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
             if (node != null) {
                 if (node.getNodeConnector() != null) {
-                    List<NodeConnector> ports = node.getNodeConnector();
+                    Collection<NodeConnector> ports = node.nonnullNodeConnector().values();
 
                     for (NodeConnector nodeConnector2 : ports) {
                         nodeConnectorCount++;
@@ -102,7 +102,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
     public void _portDescStats(CommandInterpreter ci) {
         int nodeConnectorCount = 0;
         int nodeConnectorDescStatsCount = 0;
-        List<Node> nodes = getNodes();
+        Collection<Node> nodes = getNodes();
         for (Node node2 : nodes) {
             NodeKey nodeKey = node2.key();
             InstanceIdentifier<Node> nodeRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey);
@@ -111,7 +111,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
             Node node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
             if (node != null) {
                 if (node.getNodeConnector() != null) {
-                    List<NodeConnector> ports = node.getNodeConnector();
+                    Collection<NodeConnector> ports = node.nonnullNodeConnector().values();
                     for (NodeConnector nodeConnector2 : ports) {
                         nodeConnectorCount++;
                         NodeConnectorKey nodeConnectorKey = nodeConnector2.key();
@@ -147,7 +147,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
     public void _flowStats(CommandInterpreter ci) {
         int flowCount = 0;
         int flowStatsCount = 0;
-        List<Node> nodes = getNodes();
+        Collection<Node> nodes = getNodes();
         for (Node node2 : nodes) {
             NodeKey nodeKey = node2.key();
             InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.create(Nodes.class)
@@ -157,7 +157,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
             FlowCapableNode node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
 
             if (node != null) {
-                List<Table> tables = node.getTable();
+                Collection<Table> tables = node.nonnullTable().values();
                 for (Table table2 : tables) {
                     TableKey tableKey = table2.key();
                     InstanceIdentifier<Table> tableRef = InstanceIdentifier.create(Nodes.class)
@@ -166,7 +166,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
                     Table table = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, tableRef);
                     if (table != null) {
                         if (table.getFlow() != null) {
-                            List<Flow> flows = table.getFlow();
+                            Collection<Flow> flows = table.nonnullFlow().values();
                             for (Flow flow2 : flows) {
                                 flowCount++;
                                 FlowKey flowKey = flow2.key();
@@ -202,7 +202,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
     public void _tableStats(CommandInterpreter ci) {
         int tableCount = 0;
         int tableStatsCount = 0;
-        List<Node> nodes = getNodes();
+        Collection<Node> nodes = getNodes();
         for (Node node2 : nodes) {
             NodeKey nodeKey = node2.key();
             InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.create(Nodes.class)
@@ -211,7 +211,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
             ReadTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
             FlowCapableNode node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
             if (node != null) {
-                List<Table> tables = node.getTable();
+                Collection<Table> tables = node.nonnullTable().values();
                 for (Table table2 : tables) {
                     tableCount++;
                     TableKey tableKey = table2.key();
@@ -242,7 +242,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
         int groupCount = 0;
         int groupStatsCount = 0;
         NodeGroupStatistics data = null;
-        List<Node> nodes = getNodes();
+        Collection<Node> nodes = getNodes();
         for (Node node2 : nodes) {
             NodeKey nodeKey = node2.key();
             InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.create(Nodes.class)
@@ -251,7 +251,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
             FlowCapableNode node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
             if (node != null) {
                 if (node.getGroup() != null) {
-                    List<Group> groups = node.getGroup();
+                    Collection<Group> groups = node.nonnullGroup().values();
                     for (Group group2 : groups) {
                         groupCount++;
                         GroupKey groupKey = group2.key();
@@ -283,7 +283,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
         int groupCount = 0;
         int groupDescStatsCount = 0;
         NodeGroupDescStats data = null;
-        List<Node> nodes = getNodes();
+        Collection<Node> nodes = getNodes();
         for (Node node2 : nodes) {
             NodeKey nodeKey = node2.key();
             InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.create(Nodes.class)
@@ -293,7 +293,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
 
             if (node != null) {
                 if (node.getGroup() != null) {
-                    List<Group> groups = node.getGroup();
+                    Collection<Group> groups = node.nonnullGroup().values();
                     for (Group group2 : groups) {
                         groupCount++;
                         GroupKey groupKey = group2.key();
@@ -325,7 +325,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
         int meterCount = 0;
         int meterStatsCount = 0;
         NodeMeterStatistics data = null;
-        List<Node> nodes = getNodes();
+        Collection<Node> nodes = getNodes();
         for (Node node2 : nodes) {
             NodeKey nodeKey = node2.key();
             InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.create(Nodes.class)
@@ -334,7 +334,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
             FlowCapableNode node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
             if (node != null) {
                 if (node.getMeter() != null) {
-                    List<Meter> meters = node.getMeter();
+                    Collection<Meter> meters = node.nonnullMeter().values();
                     for (Meter meter2 : meters) {
                         meterCount++;
                         MeterKey meterKey = meter2.key();
@@ -366,7 +366,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
         int meterCount = 0;
         int meterConfigStatsCount = 0;
         NodeMeterConfigStats data = null;
-        List<Node> nodes = getNodes();
+        Collection<Node> nodes = getNodes();
         for (Node node2 : nodes) {
             NodeKey nodeKey = node2.key();
             InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.create(Nodes.class)
@@ -375,7 +375,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
             FlowCapableNode node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
             if (node != null) {
                 if (node.getMeter() != null) {
-                    List<Meter> meters = node.getMeter();
+                    Collection<Meter> meters = node.nonnullMeter().values();
                     for (Meter meter2 : meters) {
                         meterCount++;
                         MeterKey meterKey = meter2.key();
@@ -407,7 +407,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
     public void _aggregateStats(CommandInterpreter ci) {
         int aggregateFlowCount = 0;
         int aggerateFlowStatsCount = 0;
-        List<Node> nodes = getNodes();
+        Collection<Node> nodes = getNodes();
         for (Node node2 : nodes) {
             NodeKey nodeKey = node2.key();
             InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.create(Nodes.class)
@@ -415,7 +415,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
             ReadTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
             FlowCapableNode node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
             if (node != null) {
-                List<Table> tables = node.getTable();
+                Collection<Table> tables = node.nonnullTable().values();
                 for (Table table2 : tables) {
                     aggregateFlowCount++;
                     TableKey tableKey = table2.key();
@@ -445,7 +445,7 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
     public void _descStats(CommandInterpreter ci) {
         int descCount = 0;
         int descStatsCount = 0;
-        List<Node> nodes = getNodes();
+        Collection<Node> nodes = getNodes();
         for (Node node2 : nodes) {
             descCount++;
             NodeKey nodeKey = node2.key();
@@ -469,14 +469,14 @@ public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
 
     }
 
-    private List<Node> getNodes() {
+    private Collection<Node> getNodes() {
         ReadTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
         InstanceIdentifier<Nodes> nodesID = InstanceIdentifier.create(Nodes.class);
         Nodes nodes = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodesID);
         if (nodes == null) {
             throw new RuntimeException("nodes are not found, pls add the node.");
         }
-        return nodes.getNode();
+        return nodes.nonnullNode().values();
     }
 
     @Override
index 5a47b1a491277d08f845a15e8736664cb534313e..282c3f4b65cf448871025e98fde5d0a293d63610 100644 (file)
@@ -28,8 +28,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
 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;
@@ -277,12 +275,6 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
 
 
     private TableFeaturePropertiesBuilder createInstructionsTblFeatureProp() {
-        InstructionBuilder ib = new InstructionBuilder();
-        ib.setOrder(1);
-        ib.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction
-                .instruction.ApplyActionsCaseBuilder().build());
-        ib.withKey(new InstructionKey(1));
-
         List<Instruction> instLst = new ArrayList<>();
         TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
         tableFeatureProperty.setTableFeaturePropType(
@@ -303,18 +295,6 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
     private TableFeaturePropertiesBuilder createInstructionsMissTblFeatureProp() {
         // To set the instructions miss -- "t7"
 
-        InstructionBuilder ib1 = new InstructionBuilder();
-        ib1.setOrder(1);
-        ib1.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction
-                .instruction.WriteMetadataCaseBuilder().build());
-        ib1.withKey(new InstructionKey(1));
-
-        InstructionBuilder ib2 = new InstructionBuilder();
-        ib2.setOrder(2);
-        ib2.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction
-                .instruction.MeterCaseBuilder().build());
-        ib2.withKey(new InstructionKey(2));
-
         List<Instruction> instLst = new ArrayList<>();
         TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
         tableFeatureProperty.setTableFeaturePropType(
@@ -595,10 +575,11 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr
                 .child(Node.class, testNode.key()).augmentation(FlowCapableNode.class)
                         .child(TableFeatures.class, new TableFeaturesKey(tableFeatures.getTableId()));
 
-        modification.merge(LogicalDatastoreType.OPERATIONAL, nodeToInstanceId(testNode), testNode, true);
-        modification.merge(LogicalDatastoreType.OPERATIONAL, path1, tableFeatures, true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, path1, tableFeatures, true);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.OPERATIONAL, nodeToInstanceId(testNode), testNode);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.OPERATIONAL, path1, tableFeatures);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode),
+                testNode);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path1, tableFeatures);
         modification.commit().addCallback(new FutureCallback<Object>() {
             @Override
             public void onSuccess(Object notUsed) {
index c36ed44ced254beed981d47ae5dd468ffdc4b663..d4de894d6671aa2ebe73860441deaea40273896e 100644 (file)
@@ -1661,8 +1661,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final List<Action> actionList = new ArrayList<>();
         final ActionBuilder ab = new ActionBuilder();
 
-        final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
-        setFieldBuilder.setInPort(new NodeConnectorId(nodeId + ":2"));
         ab.withKey(new ActionKey(0));
         actionList.add(ab.build());
 
@@ -2206,7 +2204,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         setFieldBuilder1.setLayer4Match(tcpmatch1.build());
         ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
         ab1.withKey(new ActionKey(1));
-        actionList.add(ab.build());
+        actionList.add(ab1.build());
 
         final ApplyActionsBuilder aab = new ApplyActionsBuilder();
         aab.setAction(actionList);
@@ -3184,9 +3182,9 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         final InstanceIdentifier<Flow> path1 = InstanceIdentifier.create(Nodes.class)
                 .child(Node.class, nodeBuilder.key()).augmentation(FlowCapableNode.class)
                 .child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flow.key());
-        modification.merge(LogicalDatastoreType.CONFIGURATION,
-                nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build(), true);
-        modification.merge(LogicalDatastoreType.CONFIGURATION, path1, flow.build(), true);
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION,
+                nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
+        modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path1, flow.build());
         modification.commit().addCallback(new FutureCallback<Object>() {
             @Override
             public void onSuccess(final Object notUsed) {