Bug 5540 - Remove ConvertorManager singleton 56/41756/13
authorTomas Slusny <tomas.slusny@pantheon.sk>
Tue, 12 Jul 2016 11:59:50 +0000 (13:59 +0200)
committerTomas Slusny <tomas.slusny@pantheon.sk>
Wed, 3 Aug 2016 17:13:52 +0000 (19:13 +0200)
- Removed singleton from ConvertorManager
- Added ConvertorManagerFactory
- Now ConvertorManager lookup is also based on Openflow version
- New test for ConvertorManager

Change-Id: Ib23fa304143d6e2fb7f09781acc1fd0c6a3be5e8
Signed-off-by: Tomas Slusny <tomas.slusny@pantheon.sk>
283 files changed:
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/LifecycleConductorImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/common/NodeStaticReplyTranslatorUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceManagerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractMultipartOnTheFlyService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/FlowService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/GroupService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/MeterService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestOnTheFlyCallback.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/PacketProcessingServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalFlowServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalGroupServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalMeterServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalPortServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalTableServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/SinglePurposeMultipartReplyTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtils.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/AllFlowsInAllTablesService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/AllFlowsInTableService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/AllGroupsStatsService.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/AllMeterStatsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/FlowsInTableService.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/GroupStatsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/MatchingFlowsInTableService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/MeterStatsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightGroupStatisticsServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightMeterStatisticsServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/FlowStatisticsToNotificationTransformer.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/OpendaylightFlowStatisticsServiceDelegateImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/dedicated/StatisticsGatheringOnTheFlyService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/AbstractDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/FlowDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/GroupDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/MeterDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/NodeConnectorDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/QueueDirectStatisticsService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedV10Translator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/PacketReceivedTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtils.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtils.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/TranslatorLibraryUtil.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/LifecycleConductorImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceManagerImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestOnTheFlyCallbackTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/PacketProcessingServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/SalFlowServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/SalGroupServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/SalMeterServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/SalPortServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/SalTableServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/SinglePurposeMultipartReplyTranslatorTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpMockInitiation.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImplParamTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtilsTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/AbstractStatsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl1Test.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl2Test.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl3Test.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightGroupStatisticsServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightMeterStatisticsServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/compatibility/OpendaylightFlowStatisticsServiceDelegateImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/dedicated/StatisticsGatheringOnTheFlyServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/AbstractDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/FlowDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/GroupDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/MeterDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/NodeConnectorDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/services/direct/QueueDirectStatisticsServiceTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedTranslatorTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/PacketReceivedTranslatorTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtilsTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistrationUtilsTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/TranslatorLibratyUtilTest.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/MDController.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/ModelDrivenSwitchImpl.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OFRpcTaskFactory.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OpenflowPluginProvider.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/SalRegistrationManager.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/ConvertorManagerFactory.java [new file with mode: 0644]
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/ConvertorRegistrator.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/PortConvertor.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/TableFeaturesResponseConvertor.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/action/ActionResponseConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalCopyTtlInCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalCopyTtlOutCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalDecMplsTtlCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalDecNwTtlCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalGroupCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalOutputActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalPopMplsCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalPopPbbCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalPopVlanCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalPushMplsCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalPushPbbCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalPushVlanCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalSetFieldCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalSetMplsTtlCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalSetNwDstCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalSetNwTtlCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalSetQueueCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/OfToSalStripVlanCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfCopyTtlInCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfCopyTtlOutCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfDecMplsTtlCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfDecNwTtlCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfDropActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfGeneralExtensionGroupingCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfGroupActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfOutputActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfPopMplsActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfPopPbbActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfPopVlanActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfPopVlanActionV10Case.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfPushMplsActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfPushPbbActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfPushVlanActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetDlDstActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetDlDstActionV10Case.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetDlSrcActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetDlSrcActionV10Case.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetFieldCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetFieldV10Case.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetMplsTtlActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetNwDstActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetNwDstActionV10Case.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetNwSrcActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetNwSrcActionV10Case.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetNwTosActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetNwTosActionV10Case.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetNwTtlActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetQueueActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetTpDstActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetTpDstActionV10Case.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetTpSrcActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetTpSrcActionV10Case.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetVlanIdActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetVlanIdActionV10Case.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetVlanPcpActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfSetVlanPcpActionV10Case.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfStripVlanActionCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfStripVlanActionV10Case.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/cases/SalToOfVendorCodecCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/common/ConvertReactor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/common/ConvertReactorConvertor.java [new file with mode: 0644]
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/common/Convertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/common/ConvertorCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/common/ConvertorKey.java [moved from openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/common/InjectionKey.java with 85% similarity]
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/common/ConvertorProcessor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/data/VersionDatapathIdConvertorData.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/FlowInstructionResponseConvertor.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/flow/cases/ApplyActionsCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/cases/ClearActionsCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/cases/GoToTableCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/cases/MeterCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/cases/WriteActionsCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/cases/WriteMetadataCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/flowflag/FlowFlagConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/flowflag/FlowFlagReactor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/flowflag/FlowFlagReactorMappingFactory.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/flowflag/FlowFlagsConvertorImpl.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/flowflag/FlowFlagsConvertorV10Impl.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/MatchConvertorImpl.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchConvertorV10Impl.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchReactor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchReactorMappingFactory.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchResponseConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchV10ResponseConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalArpOpCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalArpShaCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalArpSpaCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalArpThaCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalArpTpaCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalEthDstCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalEthSrcCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalEthTypeCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalExperimenterIdCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIcmpv4CodeCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIcmpv4TypeCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIcmpv6CodeCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIcmpv6TypeCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalInPhyPortCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalInPortCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIpDscpCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIpEcnCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIpProtoCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIpv4DstCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIpv4SrcCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIpv6DstCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIpv6ExthdrCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIpv6FlabelCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIpv6NdSllCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIpv6NdTargetCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIpv6NdTllCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalIpv6SrcCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalMetadataCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalMplsBosCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalMplsLabelCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalMplsTcCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalPbbIsidCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalSctpDstCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalSctpSrcCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalTcpDstCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalTcpSrcCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalTunnelIdCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalTunnelIpv4DstCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalTunnelIpv4SrcCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalUdpDstCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalUdpSrcCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalVlanPcpCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/OfToSalVlanVidCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/SalToOfArpMatchCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/SalToOfIpv4MatchArbitraryBitMaskCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/SalToOfIpv4MatchCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/SalToOfIpv6MatchArbitraryBitMaskCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/SalToOfIpv6MatchCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/SalToOfSctpMatchCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/SalToOfTcpMatchCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/SalToOfTunnelIpv4MatchCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/cases/SalToOfUdpMatchCase.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/translator/FlowRemovedTranslator.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTableFeaturesToTableUpdatedTranslator.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTranslator.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/translator/PacketInTranslator.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/ConnectionConductorImplTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/MDControllerTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/ConcurrentSalRegistrationManagerTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/ModelDrivenSwitchImplTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OFRpcTaskUtilTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/SalRegistrationManagerTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/ConvertorManagerTest.java [new file with mode: 0644]
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/MeterConfigStatsResponseConvertorTest.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/PortConvertorTest.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/action/ActionConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/ActionConvertorV10Test.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/action/ActionConvertorV13Test.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/flow/FlowStatsResponseConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/flow/flowflag/FlowFlagReactorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchConvertorImpl2Test.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchConvertorV10ImplTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchReactorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchResponseConvertor2Test.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchResponseConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchV10ResponseConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/session/SessionManagerOFImplTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/translator/FlowRemovedTranslatorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTableFeaturesToTableUpdatedTranslatorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTranslatorFifthTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTranslatorFirstTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTranslatorFourthTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTranslatorSecondTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTranslatorThirdTest.java

index af2efaf21f8ea67b4589fd2b959614ea8cf6d8ba..24e1d7e2ef07af03214fea9890b1004c976484e8 100644 (file)
@@ -43,6 +43,7 @@ import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.Messa
 import org.opendaylight.openflowplugin.extension.api.ExtensionConverterProviderKeeper;
 import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider;
 import org.opendaylight.openflowplugin.impl.util.MdSalRegistrationUtils;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 import org.slf4j.Logger;
@@ -62,11 +63,13 @@ final class LifecycleConductorImpl implements LifecycleConductor, RoleChangeList
     private StatisticsManager statisticsManager;
     private RpcManager rpcManager;
     private final MessageIntelligenceAgency messageIntelligenceAgency;
+    private final ConvertorExecutor convertorExecutor;
     private ConcurrentHashMap<DeviceInfo, ServiceChangeListener> serviceChangeListeners = new ConcurrentHashMap<>();
     private NotificationPublishService notificationPublishService;
 
-    LifecycleConductorImpl(final MessageIntelligenceAgency messageIntelligenceAgency) {
+    LifecycleConductorImpl(final MessageIntelligenceAgency messageIntelligenceAgency, ConvertorExecutor convertorExecutor) {
         this.messageIntelligenceAgency = Preconditions.checkNotNull(messageIntelligenceAgency);
+        this.convertorExecutor = convertorExecutor;
     }
 
     @Override
@@ -166,13 +169,13 @@ final class LifecycleConductorImpl implements LifecycleConductor, RoleChangeList
         if (OfpRole.BECOMEMASTER.equals(newRole)) {
             logText = "Start";
             fillDeviceFlowRegistry(deviceInfo, deviceContext.getDeviceFlowRegistry());
-            MdSalRegistrationUtils.registerServices(rpcContext, deviceContext, this.extensionConverterProvider);
+            MdSalRegistrationUtils.registerServices(rpcContext, deviceContext, this.extensionConverterProvider, convertorExecutor);
 
             if (rpcContext.isStatisticsRpcEnabled()) {
                 MdSalRegistrationUtils.registerStatCompatibilityServices(
                         rpcContext,
                         deviceContext,
-                        notificationPublishService);
+                        notificationPublishService, convertorExecutor);
             }
         } else {
             logText = "Stopp";
index 70c4da81bd5bb4f74b1e7f19fdd58a6d53d59287..7215fa6ab34103f6b8921dec50367570ce72e363 100644 (file)
@@ -57,6 +57,8 @@ import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.MessageIntell
 import org.opendaylight.openflowplugin.impl.util.TranslatorLibraryUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.ThreadPoolLoggingExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionConverterManagerImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -68,6 +70,7 @@ public class OpenFlowPluginProviderImpl implements OpenFlowPluginProvider, OpenF
 
     private final int rpcRequestsQuota;
     private final long globalNotificationQuota;
+    private final ConvertorManager convertorManager;
     private long barrierInterval;
     private int barrierCountLimit;
     private long echoReplyTimeout;
@@ -112,7 +115,8 @@ public class OpenFlowPluginProviderImpl implements OpenFlowPluginProvider, OpenF
                 Preconditions.checkNotNull(threadPoolTimeout), TimeUnit.SECONDS,
                 new SynchronousQueue<>(), "ofppool");
 
-        conductor = new LifecycleConductorImpl(messageIntelligenceAgency);
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
+        conductor = new LifecycleConductorImpl(messageIntelligenceAgency, convertorManager);
     }
 
     @Override
@@ -224,7 +228,8 @@ public class OpenFlowPluginProviderImpl implements OpenFlowPluginProvider, OpenF
                 barrierInterval,
                 barrierCountLimit,
                 conductor,
-                isNotificationFlowRemovedOff);
+                isNotificationFlowRemovedOff,
+                convertorManager);
         ((ExtensionConverterProviderKeeper) conductor).setExtensionConverterProvider(extensionConverterManager);
         ((ExtensionConverterProviderKeeper) deviceManager).setExtensionConverterProvider(extensionConverterManager);
 
@@ -232,7 +237,7 @@ public class OpenFlowPluginProviderImpl implements OpenFlowPluginProvider, OpenF
         conductor.setNotificationPublishService(notificationPublishService);
 
         roleManager = new RoleManagerImpl(entityOwnershipService, dataBroker, conductor);
-        statisticsManager = new StatisticsManagerImpl(rpcProviderRegistry, isStatisticsPollingOff, conductor);
+        statisticsManager = new StatisticsManagerImpl(rpcProviderRegistry, isStatisticsPollingOff, conductor, convertorManager);
         conductor.setSafelyManager(statisticsManager);
 
         rpcManager = new RpcManagerImpl(rpcProviderRegistry, rpcRequestsQuota, conductor);
@@ -256,7 +261,7 @@ public class OpenFlowPluginProviderImpl implements OpenFlowPluginProvider, OpenF
 
         rpcManager.setStatisticsRpcEnabled(isStatisticsRpcEnabled);
 
-        TranslatorLibraryUtil.setBasicTranslatorLibrary(deviceManager);
+        TranslatorLibraryUtil.injectBasicTranslatorLibrary(deviceManager, convertorManager);
         deviceManager.initialize();
 
         startSwitchConnections();
index 8a2284c3d9f56e8f18a24d2c3ae909b8483372cb..9828888c835f2feb83d22047e21cb96122e3490b 100644 (file)
@@ -15,7 +15,8 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.CheckForNull;
 import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
@@ -217,12 +218,15 @@ public class NodeStaticReplyTranslatorUtil {
      * table can have List of TableFeatures so add it directly to
      * {@link org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder}
      *
-     * @param reply
-     * @return
+     * @param reply reply
+     * @param version Openflow version
+     * @param convertorExecutor convertor executor
+     * @return list of table features
      */
-    public static List<TableFeatures> nodeTableFeatureTranslator(@CheckForNull final MultipartReplyTableFeatures reply) {
+    public static List<TableFeatures> nodeTableFeatureTranslator(@CheckForNull final MultipartReplyTableFeatures reply, final short version, @CheckForNull final ConvertorExecutor convertorExecutor) {
         Preconditions.checkArgument(reply != null);
-        final Optional<List<TableFeatures>> tableFeaturesList = ConvertorManager.getInstance().convert(reply);
+        Preconditions.checkArgument(convertorExecutor != null);
+        final Optional<List<TableFeatures>> tableFeaturesList = convertorExecutor.convert(reply, new VersionConvertorData(version));
         return tableFeaturesList.orElse(Collections.emptyList());
     }
 
index f9ee7ce84f222e5a5f585b43c873231ea5f3da1a..154c226fa9ca2ad95e8a07a8505ab4d4265500a1 100644 (file)
@@ -52,6 +52,7 @@ import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionCon
 import org.opendaylight.openflowplugin.impl.connection.OutboundQueueProviderImpl;
 import org.opendaylight.openflowplugin.impl.device.listener.OpenflowProtocolListenerFullImpl;
 import org.opendaylight.openflowplugin.impl.util.DeviceInitializationUtils;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
@@ -74,6 +75,7 @@ public class DeviceManagerImpl implements DeviceManager, ExtensionConverterProvi
     private static final int SPY_RATE = 10;
 
     private final DataBroker dataBroker;
+    private final ConvertorExecutor convertorExecutor;
     private TranslatorLibrary translatorLibrary;
     private DeviceInitializationPhaseHandler deviceInitPhaseHandler;
     private DeviceTerminationPhaseHandler deviceTerminPhaseHandler;
@@ -92,11 +94,13 @@ public class DeviceManagerImpl implements DeviceManager, ExtensionConverterProvi
     public DeviceManagerImpl(@Nonnull final DataBroker dataBroker,
                              final long globalNotificationQuota, final boolean switchFeaturesMandatory,
                              final long barrierInterval, final int barrierCountLimit,
-                             final LifecycleConductor lifecycleConductor, boolean isNotificationFlowRemovedOff) {
+                             final LifecycleConductor lifecycleConductor, boolean isNotificationFlowRemovedOff,
+                             final ConvertorExecutor convertorExecutor) {
         this.switchFeaturesMandatory = switchFeaturesMandatory;
         this.globalNotificationQuota = globalNotificationQuota;
         this.isNotificationFlowRemovedOff = isNotificationFlowRemovedOff;
         this.dataBroker = Preconditions.checkNotNull(dataBroker);
+        this.convertorExecutor = convertorExecutor;
         /* merge empty nodes to oper DS to predict any problems with missing parent for Node */
         final WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
 
@@ -379,7 +383,7 @@ public class DeviceManagerImpl implements DeviceManager, ExtensionConverterProvi
         ((DeviceContextImpl)deviceContext).getTransactionChainManager().activateTransactionManager();
         /* Init Collecting NodeInfo */
         final ListenableFuture<Void> initCollectingDeviceInfo = DeviceInitializationUtils.initializeNodeInformation(
-                deviceContext, switchFeaturesMandatory);
+                deviceContext, switchFeaturesMandatory, convertorExecutor);
         /* Init Collecting StatInfo */
         final ListenableFuture<Boolean> statPollFuture = Futures.transform(initCollectingDeviceInfo,
                 new AsyncFunction<Void, Boolean>() {
index e20a48dd6ea89d99d372db6be3afc50b2bf115c7..06ccafd774f1d90495b6d0e7158206bf8d3fd9e8 100644 (file)
@@ -13,19 +13,24 @@ import java.util.List;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
 
 public abstract class AbstractMultipartOnTheFlyService<I> extends AbstractService<I, List<MultipartReply>> {
-    protected AbstractMultipartOnTheFlyService(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+    private final ConvertorExecutor convertorExecutor;
+
+    protected AbstractMultipartOnTheFlyService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext);
+        this.convertorExecutor = convertorExecutor;
     }
 
     @Override
     protected final FutureCallback<OfHeader> createCallback(final RequestContext<List<MultipartReply>> context, final Class<?> requestType) {
         return new MultipartRequestOnTheFlyCallback(context, requestType,
                 getMessageSpy(), getEventIdentifier(), getDeviceInfo(),
-                getDeviceContext().getDeviceFlowRegistry(), getTxFacade());
+                getDeviceContext().getDeviceFlowRegistry(), getTxFacade(),
+                convertorExecutor);
     }
 
 
index 8fdab8939769a3b1e9ab0b6668c631b16a4f764e..e3fbb01c027ddf5ceea8bcdf758d98de160974c7 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
@@ -31,8 +31,14 @@ import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 
 final class FlowService<O extends DataObject> extends AbstractSimpleService<FlowModInputBuilder, O> {
 
-    protected FlowService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final Class<O> clazz) {
+    private final ConvertorExecutor convertorExecutor;
+    private final VersionDatapathIdConvertorData data;
+
+    protected FlowService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final Class<O> clazz, final ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, clazz);
+        this.convertorExecutor = convertorExecutor;
+        data = new VersionDatapathIdConvertorData(getVersion());
+        data.setDatapathId(getDatapathId());
     }
 
     @Override
@@ -42,10 +48,7 @@ final class FlowService<O extends DataObject> extends AbstractSimpleService<Flow
     }
 
     List<FlowModInputBuilder> toFlowModInputs(final Flow input) {
-        final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
-        data.setDatapathId(getDatapathId());
-
-        final Optional<List<FlowModInputBuilder>> flowModInputBuilders = ConvertorManager.getInstance().convert(input, data);
+        final Optional<List<FlowModInputBuilder>> flowModInputBuilders = convertorExecutor.convert(input, data);
         return flowModInputBuilders.orElse(Collections.emptyList());
     }
 
index b165d8bdb1fa0d24bc74ff8bf96a2d3e729736b9..d0f50eaa74a0de2792473859c680a050509ad25d 100644 (file)
@@ -11,7 +11,7 @@ import java.util.Optional;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.GroupConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group;
@@ -20,17 +20,19 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
 final class GroupService<I extends Group, O extends DataObject> extends AbstractSimpleService<I, O> {
-    GroupService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final Class<O> clazz) {
+    private final ConvertorExecutor convertorExecutor;
+    private final VersionDatapathIdConvertorData data;
+
+    GroupService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final Class<O> clazz, final ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, clazz);
+        this.convertorExecutor = convertorExecutor;
+        data = new VersionDatapathIdConvertorData(getVersion());
+        data.setDatapathId(getDatapathId());
     }
 
     @Override
     protected OfHeader buildRequest(final Xid xid, final I input) {
-        final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
-        data.setDatapathId(getDatapathId());
-        final Optional<GroupModInputBuilder> ofGroupModInput = ConvertorManager
-                .getInstance()
-                .convert(input, data);
+        final Optional<GroupModInputBuilder> ofGroupModInput = convertorExecutor.convert(input, data);
 
         final GroupModInputBuilder groupModInputBuilder = ofGroupModInput
                 .orElse(GroupConvertor.defaultResult(getVersion()))
index 94009f06710c4896d483b640e9f21fa801028515..91d4abbacbdca82c53c9c2b27cd837ef2477c752 100644 (file)
@@ -11,7 +11,7 @@ import java.util.Optional;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.MeterConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter;
@@ -21,14 +21,18 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 
 final class MeterService<I extends Meter, O extends DataObject> extends AbstractSimpleService<I, O> {
 
-    MeterService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final Class<O> clazz) {
+    private final ConvertorExecutor convertorExecutor;
+    private final VersionConvertorData data;
+
+    MeterService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final Class<O> clazz, final ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, clazz);
+        this.convertorExecutor = convertorExecutor;
+        data = new VersionConvertorData(getVersion());
     }
 
     @Override
     protected OfHeader buildRequest(final Xid xid, final I input) {
-        final VersionConvertorData data = new VersionConvertorData(getVersion());
-        final Optional<MeterModInputBuilder> ofMeterModInput = ConvertorManager.getInstance().convert(input, data);
+        final Optional<MeterModInputBuilder> ofMeterModInput = convertorExecutor.convert(input, data);
         final MeterModInputBuilder meterModInputBuilder = ofMeterModInput
                 .orElse(MeterConvertor.defaultResult(getVersion()));
 
index dcb445b11e03db4717fcc91d1ab4f5b865730695..9b1c0e729158ba831b4fe13ce4dcd379f13501fe 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.Messa
 import org.opendaylight.openflowplugin.impl.statistics.SinglePurposeMultipartReplyTranslator;
 import org.opendaylight.openflowplugin.impl.statistics.StatisticsGatheringUtils;
 import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.EventsTimeCounter;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
 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;
@@ -34,7 +35,7 @@ import org.slf4j.LoggerFactory;
 
 final class MultipartRequestOnTheFlyCallback extends AbstractRequestCallback<List<MultipartReply>> {
     private static final Logger LOG = LoggerFactory.getLogger(MultipartRequestOnTheFlyCallback.class);
-    private static final SinglePurposeMultipartReplyTranslator MULTIPART_REPLY_TRANSLATOR = new SinglePurposeMultipartReplyTranslator();
+    private final SinglePurposeMultipartReplyTranslator multipartReplyTranslator;
     private final DeviceInfo deviceInfo;
     private final DeviceFlowRegistry registry;
     private boolean virgin = true;
@@ -49,13 +50,16 @@ final class MultipartRequestOnTheFlyCallback extends AbstractRequestCallback<Lis
                                             final EventIdentifier eventIdentifier,
                                             final DeviceInfo deviceInfo,
                                             final DeviceFlowRegistry registry,
-                                            final TxFacade txFacade) {
+                                            final TxFacade txFacade,
+                                            final ConvertorExecutor convertorExecutor) {
         super(context, requestType, messageSpy, eventIdentifier);
 
         this.deviceInfo = deviceInfo;
         this.registry = registry;
         this.txFacade = txFacade;
 
+        multipartReplyTranslator = new SinglePurposeMultipartReplyTranslator(convertorExecutor);
+
         //TODO: this is focused on flow stats only - need more general approach if used for more than flow stats
         doneEventIdentifier = new EventIdentifier(MultipartType.OFPMPFLOW.name(), deviceInfo.getNodeId().toString());
     }
@@ -88,7 +92,7 @@ final class MultipartRequestOnTheFlyCallback extends AbstractRequestCallback<Lis
             final MultipartReply multipartReply = (MultipartReply) result;
 
             final MultipartReply singleReply = multipartReply;
-            final List<? extends DataObject> multipartDataList = MULTIPART_REPLY_TRANSLATOR.translate(
+            final List<? extends DataObject> multipartDataList = multipartReplyTranslator.translate(
                     deviceInfo.getDatapathId(), deviceInfo.getVersion(), singleReply);
             final Iterable<? extends DataObject> allMultipartData = multipartDataList;
 
index 348495c44a39792262a32696a78c3a7d17c40764..b8449e49545e50faba0a24de2fa137847750fe35 100644 (file)
@@ -12,7 +12,7 @@ import java.util.concurrent.Future;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PacketOutConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.PacketOutConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
@@ -23,8 +23,11 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 
 public final class PacketProcessingServiceImpl extends AbstractVoidService<TransmitPacketInput> implements PacketProcessingService {
 
-    public PacketProcessingServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+    private final ConvertorExecutor convertorExecutor;
+
+    public PacketProcessingServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext);
+        this.convertorExecutor = convertorExecutor;
     }
 
     @Override
@@ -38,7 +41,7 @@ public final class PacketProcessingServiceImpl extends AbstractVoidService<Trans
         data.setDatapathId(getDatapathId());
         data.setXid(xid.getValue());
 
-        final Optional<PacketOutInput> result = ConvertorManager.getInstance().convert(input, data);
+        final Optional<PacketOutInput> result = convertorExecutor.convert(input, data);
         return result.orElse(PacketOutConvertor.defaultResult(getVersion()));
     }
 }
index c0ab557425994f2d06426f6820db02fdbb4099ab..8609c1192f2656d4c29651e4369fcfdedce2c29d 100644 (file)
@@ -26,6 +26,7 @@ import org.opendaylight.openflowplugin.api.openflow.rpc.ItemLifeCycleSource;
 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
 import org.opendaylight.openflowplugin.impl.registry.flow.FlowDescriptorFactory;
 import org.opendaylight.openflowplugin.impl.registry.flow.FlowRegistryKeyFactory;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.util.FlowCreatorUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
@@ -62,11 +63,11 @@ public class SalFlowServiceImpl implements SalFlowService, ItemLifeCycleSource {
     private final DeviceContext deviceContext;
     private ItemLifecycleListener itemLifecycleListener;
 
-    public SalFlowServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+    public SalFlowServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
         this.deviceContext = deviceContext;
-        flowRemove = new FlowService(requestContextStack, deviceContext, RemoveFlowOutput.class);
-        flowAdd = new FlowService<>(requestContextStack, deviceContext, AddFlowOutput.class);
-        flowUpdate = new FlowService<>(requestContextStack, deviceContext, UpdateFlowOutput.class);
+        flowRemove = new FlowService<>(requestContextStack, deviceContext, RemoveFlowOutput.class, convertorExecutor);
+        flowAdd = new FlowService<>(requestContextStack, deviceContext, AddFlowOutput.class, convertorExecutor);
+        flowUpdate = new FlowService<>(requestContextStack, deviceContext, UpdateFlowOutput.class, convertorExecutor);
     }
 
     @Override
index cdbc10b6f08f0083cf503a734154994c0ca60c6a..41ea6d5181a021fb98a51951b1f189157ad250a8 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.rpc.ItemLifeCycleSource;
 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
@@ -45,11 +46,11 @@ public class SalGroupServiceImpl implements SalGroupService, ItemLifeCycleSource
     private final DeviceContext deviceContext;
     private ItemLifecycleListener itemLifecycleListener;
 
-    public SalGroupServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+    public SalGroupServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
         this.deviceContext = deviceContext;
-        addGroup = new GroupService<>(requestContextStack, deviceContext, AddGroupOutput.class);
-        updateGroup = new GroupService<>(requestContextStack, deviceContext, UpdateGroupOutput.class);
-        removeGroup = new GroupService<>(requestContextStack, deviceContext, RemoveGroupOutput.class);
+        addGroup = new GroupService<>(requestContextStack, deviceContext, AddGroupOutput.class, convertorExecutor);
+        updateGroup = new GroupService<>(requestContextStack, deviceContext, UpdateGroupOutput.class, convertorExecutor);
+        removeGroup = new GroupService<>(requestContextStack, deviceContext, RemoveGroupOutput.class, convertorExecutor);
     }
 
     @Override
index b053d99cb8fc361361d93ccbebe1d0be955b5f36..2ed7df5f8441bb953abc7dba3ad208074647c786 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.rpc.ItemLifeCycleSource;
 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey;
@@ -45,11 +46,11 @@ public class SalMeterServiceImpl implements SalMeterService, ItemLifeCycleSource
     private ItemLifecycleListener itemLifecycleListener;
     private final DeviceContext deviceContext;
 
-    public SalMeterServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+    public SalMeterServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
         this.deviceContext = deviceContext;
-        addMeter = new MeterService<>(requestContextStack, deviceContext, AddMeterOutput.class);
-        updateMeter = new MeterService<>(requestContextStack, deviceContext, UpdateMeterOutput.class);
-        removeMeter = new MeterService<>(requestContextStack, deviceContext, RemoveMeterOutput.class);
+        addMeter = new MeterService<>(requestContextStack, deviceContext, AddMeterOutput.class, convertorExecutor);
+        updateMeter = new MeterService<>(requestContextStack, deviceContext, UpdateMeterOutput.class, convertorExecutor);
+        removeMeter = new MeterService<>(requestContextStack, deviceContext, RemoveMeterOutput.class, convertorExecutor);
     }
 
     @Override
index 674d6b23743510fb46b788afe42d69a0b5c266cd..86f9afe8e98174c068903c4db3aeca90ec5aed66 100644 (file)
@@ -12,7 +12,7 @@ import java.util.concurrent.Future;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PortConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port;
@@ -25,8 +25,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.Upda
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
 public final class SalPortServiceImpl extends AbstractSimpleService<UpdatePortInput, UpdatePortOutput> implements SalPortService {
-    public SalPortServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+    private final ConvertorExecutor convertorExecutor;
+    private final VersionConvertorData data;
+
+    public SalPortServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, UpdatePortOutput.class);
+        this.convertorExecutor = convertorExecutor;
+        data = new VersionConvertorData(getVersion());
     }
 
     @Override
@@ -37,9 +42,7 @@ public final class SalPortServiceImpl extends AbstractSimpleService<UpdatePortIn
     @Override
     protected OfHeader buildRequest(final Xid xid, final UpdatePortInput input) {
         final Port inputPort = input.getUpdatedPort().getPort().getPort().get(0);
-        final Optional<PortModInput> ofPortModInput = ConvertorManager
-                .getInstance()
-                .convert(inputPort, new VersionConvertorData(getVersion()));
+        final Optional<PortModInput> ofPortModInput = convertorExecutor.convert(inputPort, data);
 
         final PortModInputBuilder mdInput = new PortModInputBuilder(ofPortModInput
                 .orElse(PortConvertor.defaultResult(getVersion())))
index 7282896ea765f68dba5552f1f17ec668d2ac7399..25ccd243ae49e1b9a44628d91b963349e881bd56 100644 (file)
@@ -22,10 +22,10 @@ import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.TxFacade;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
-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.NodeKey;
@@ -55,13 +55,14 @@ import org.slf4j.Logger;
 public final class SalTableServiceImpl extends AbstractMultipartService<UpdateTableInput> implements SalTableService {
     private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(SalTableServiceImpl.class);
     private final TxFacade txFacade;
-    private final NodeId nodeId;
+    private final ConvertorExecutor convertorExecutor;
+    private final VersionConvertorData data;
 
-    public SalTableServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext,
-                               final NodeId nodeId) {
+    public SalTableServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext);
         this.txFacade = deviceContext;
-        this.nodeId = nodeId;
+        this.convertorExecutor = convertorExecutor;
+        data = new VersionConvertorData(getVersion());
     }
 
     @Override
@@ -134,7 +135,7 @@ public final class SalTableServiceImpl extends AbstractMultipartService<UpdateTa
         txFacade.submitTransaction();
     }
 
-    protected static List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures> convertToSalTableFeatures(
+    protected List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures> convertToSalTableFeatures(
             final List<MultipartReply> multipartReplies) {
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures> salTableFeaturesAll = new ArrayList<>();
         for (final MultipartReply multipartReply : multipartReplies) {
@@ -146,7 +147,7 @@ public final class SalTableServiceImpl extends AbstractMultipartService<UpdateTa
                             .getMultipartReplyTableFeatures();
 
                     final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures>> salTableFeaturesPartial =
-                            ConvertorManager.getInstance().convert(salTableFeatures);
+                            convertorExecutor.convert(salTableFeatures, data);
 
                     if (salTableFeaturesPartial.isPresent()) {
                         salTableFeaturesAll.addAll(salTableFeaturesPartial.get());
@@ -173,7 +174,7 @@ public final class SalTableServiceImpl extends AbstractMultipartService<UpdateTa
         final MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
         final MultipartRequestTableFeaturesBuilder requestBuilder = new MultipartRequestTableFeaturesBuilder();
 
-        final Optional<List<TableFeatures>> ofTableFeatureList = ConvertorManager.getInstance().convert(input.getUpdatedTable());
+        final Optional<List<TableFeatures>> ofTableFeatureList = convertorExecutor.convert(input.getUpdatedTable(), data);
         requestBuilder.setTableFeatures(ofTableFeatureList.orElse(Collections.emptyList()));
         caseBuilder.setMultipartRequestTableFeatures(requestBuilder.build());
 
index 676badbd512ffe233b4051b3d7ba73e686f5c87e..80c9d42cfa5854435303737d7338918756d2d937 100644 (file)
@@ -13,8 +13,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
@@ -110,6 +109,11 @@ public class SinglePurposeMultipartReplyTranslator {
 
     protected static final Logger logger = LoggerFactory
             .getLogger(SinglePurposeMultipartReplyTranslator.class);
+    private final ConvertorExecutor convertorExecutor;
+
+    public SinglePurposeMultipartReplyTranslator(ConvertorExecutor convertorExecutor) {
+        this.convertorExecutor = convertorExecutor;
+    }
 
     public List<DataObject> translate(final BigInteger datapathId, final short version, final OfHeader msg) {
 
@@ -119,18 +123,17 @@ public class SinglePurposeMultipartReplyTranslator {
             MultipartReplyMessage mpReply = (MultipartReplyMessage) msg;
             OpenflowVersion ofVersion = OpenflowVersion.get(version);
             NodeId node = nodeIdFromDatapathId(datapathId);
-            VersionDatapathIdConvertorData versionDatapathIdConvertorData = new VersionDatapathIdConvertorData(version);
-            versionDatapathIdConvertorData.setDatapathId(datapathId);
-            VersionConvertorData simpleConvertorData = new VersionConvertorData(version);
+            VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
+            data.setDatapathId(datapathId);
 
-            translateFlow(listDataObject, mpReply, node, versionDatapathIdConvertorData);
+            translateFlow(listDataObject, mpReply, node, data);
             translateAggregate(listDataObject, mpReply, node);
             translatePortStats(listDataObject, mpReply, node, ofVersion, datapathId);
-            translateGroup(listDataObject, mpReply, node);
-            translateGroupDesc(listDataObject, mpReply, node, simpleConvertorData);
+            translateGroup(listDataObject, mpReply, node, data);
+            translateGroupDesc(listDataObject, mpReply, node, data);
             translateGroupFeatures(listDataObject, mpReply, node);
-            translateMeter(listDataObject, mpReply, node);
-            translateMeterConfig(listDataObject, mpReply, node);
+            translateMeter(listDataObject, mpReply, node, data);
+            translateMeterConfig(listDataObject, mpReply, node, data);
             translateMeterFeatures(listDataObject, mpReply, node);
             translateTable(listDataObject, mpReply, node);
             translateQueue(listDataObject, mpReply, node, ofVersion, datapathId);
@@ -139,9 +142,9 @@ public class SinglePurposeMultipartReplyTranslator {
         return listDataObject;
     }
 
-    private static void translateFlow(final List<DataObject> listDataObject,
-                                      final MultipartReplyMessage mpReply,
-                                      final NodeId node, VersionDatapathIdConvertorData versionDatapathIdConvertorData) {
+    private void translateFlow(final List<DataObject> listDataObject,
+                               final MultipartReplyMessage mpReply,
+                               final NodeId node, VersionDatapathIdConvertorData data) {
         if (!MultipartType.OFPMPFLOW.equals(mpReply.getType())) {
             return;
         }
@@ -153,16 +156,16 @@ public class SinglePurposeMultipartReplyTranslator {
         MultipartReplyFlowCase caseBody = (MultipartReplyFlowCase) mpReply.getMultipartReplyBody();
         MultipartReplyFlow replyBody = caseBody.getMultipartReplyFlow();
         final Optional<List<FlowAndStatisticsMapList>> flowAndStatisticsMapLists =
-                ConvertorManager.getInstance().convert(replyBody.getFlowStats(), versionDatapathIdConvertorData);
+                convertorExecutor.convert(replyBody.getFlowStats(), data);
 
         message.setFlowAndStatisticsMapList(flowAndStatisticsMapLists.orElse(Collections.emptyList()));
 
         listDataObject.add(message.build());
     }
 
-    private static void translateAggregate(final List<DataObject> listDataObject,
-                                           final MultipartReplyMessage mpReply,
-                                           final NodeId node) {
+    private void translateAggregate(final List<DataObject> listDataObject,
+                                    final MultipartReplyMessage mpReply,
+                                    final NodeId node) {
         if (!MultipartType.OFPMPAGGREGATE.equals(mpReply.getType())) {
             return;
         }
@@ -181,11 +184,11 @@ public class SinglePurposeMultipartReplyTranslator {
         listDataObject.add(message.build());
     }
 
-    private static void translatePortStats(final List<DataObject> listDataObject,
-                                           final MultipartReplyMessage mpReply,
-                                           final NodeId node,
-                                           final OpenflowVersion ofVersion,
-                                           final BigInteger datapathId) {
+    private void translatePortStats(final List<DataObject> listDataObject,
+                                    final MultipartReplyMessage mpReply,
+                                    final NodeId node,
+                                    final OpenflowVersion ofVersion,
+                                    final BigInteger datapathId) {
         if (!MultipartType.OFPMPPORTSTATS.equals(mpReply.getType())) {
             return;
         }
@@ -244,9 +247,10 @@ public class SinglePurposeMultipartReplyTranslator {
         listDataObject.add(message.build());
     }
 
-    private static void translateGroup(final List<DataObject> listDataObject,
-                                       final MultipartReplyMessage mpReply,
-                                       final NodeId node) {
+    private void translateGroup(final List<DataObject> listDataObject,
+                                final MultipartReplyMessage mpReply,
+                                final NodeId node,
+                                final VersionDatapathIdConvertorData data) {
         if (!MultipartType.OFPMPGROUP.equals(mpReply.getType())) {
             return;
         }
@@ -257,18 +261,18 @@ public class SinglePurposeMultipartReplyTranslator {
         message.setTransactionId(generateTransactionId(mpReply.getXid()));
         MultipartReplyGroupCase caseBody = (MultipartReplyGroupCase) mpReply.getMultipartReplyBody();
         MultipartReplyGroup replyBody = caseBody.getMultipartReplyGroup();
-        final Optional<List<GroupStats>> groupStatsList = ConvertorManager.getInstance().convert(
-                replyBody.getGroupStats());
+        final Optional<List<GroupStats>> groupStatsList = convertorExecutor.convert(
+                replyBody.getGroupStats(), data);
 
         message.setGroupStats(groupStatsList.orElse(Collections.emptyList()));
 
         listDataObject.add(message.build());
     }
 
-    private static void translateGroupDesc(final List<DataObject> listDataObject,
-                                           final MultipartReplyMessage mpReply,
-                                           final NodeId node,
-                                           VersionConvertorData simpleConvertorData) {
+    private void translateGroupDesc(final List<DataObject> listDataObject,
+                                    final MultipartReplyMessage mpReply,
+                                    final NodeId node,
+                                    final VersionDatapathIdConvertorData data) {
         if (!MultipartType.OFPMPGROUPDESC.equals(mpReply.getType())) {
             return;
         }
@@ -280,17 +284,17 @@ public class SinglePurposeMultipartReplyTranslator {
         MultipartReplyGroupDescCase caseBody = (MultipartReplyGroupDescCase) mpReply.getMultipartReplyBody();
         MultipartReplyGroupDesc replyBody = caseBody.getMultipartReplyGroupDesc();
 
-        final Optional<List<GroupDescStats>> groupDescStatsList = ConvertorManager.getInstance().convert(
-                replyBody.getGroupDesc(), simpleConvertorData);
+        final Optional<List<GroupDescStats>> groupDescStatsList = convertorExecutor.convert(
+                replyBody.getGroupDesc(), data);
 
         message.setGroupDescStats(groupDescStatsList.orElse(Collections.emptyList()));
 
         listDataObject.add(message.build());
     }
 
-    private static void translateGroupFeatures(final List<DataObject> listDataObject,
-                                               final MultipartReplyMessage mpReply,
-                                               final NodeId node) {
+    private void translateGroupFeatures(final List<DataObject> listDataObject,
+                                        final MultipartReplyMessage mpReply,
+                                        final NodeId node) {
         if (!MultipartType.OFPMPGROUPFEATURES.equals(mpReply.getType())) {
             return;
         }
@@ -341,9 +345,10 @@ public class SinglePurposeMultipartReplyTranslator {
         listDataObject.add(message.build());
     }
 
-    private static void translateMeter(final List<DataObject> listDataObject,
-                                       final MultipartReplyMessage mpReply,
-                                       final NodeId node) {
+    private void translateMeter(final List<DataObject> listDataObject,
+                                final MultipartReplyMessage mpReply,
+                                final NodeId node,
+                                final VersionDatapathIdConvertorData data) {
         if (!MultipartType.OFPMPMETER.equals(mpReply.getType())) {
             return;
         }
@@ -356,16 +361,17 @@ public class SinglePurposeMultipartReplyTranslator {
         MultipartReplyMeterCase caseBody = (MultipartReplyMeterCase) mpReply.getMultipartReplyBody();
         MultipartReplyMeter replyBody = caseBody.getMultipartReplyMeter();
         final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats>> meterStatsList =
-                ConvertorManager.getInstance().convert(replyBody.getMeterStats());
+                convertorExecutor.convert(replyBody.getMeterStats(), data);
 
         message.setMeterStats(meterStatsList.orElse(Collections.emptyList()));
 
         listDataObject.add(message.build());
     }
 
-    private static void translateMeterConfig(final List<DataObject> listDataObject,
-                                             final MultipartReplyMessage mpReply,
-                                             final NodeId node) {
+    private void translateMeterConfig(final List<DataObject> listDataObject,
+                                      final MultipartReplyMessage mpReply,
+                                      final NodeId node,
+                                      final VersionDatapathIdConvertorData data) {
         if (!MultipartType.OFPMPMETERCONFIG.equals(mpReply.getType())) {
             return;
         }
@@ -377,14 +383,14 @@ public class SinglePurposeMultipartReplyTranslator {
 
         MultipartReplyMeterConfigCase caseBody = (MultipartReplyMeterConfigCase) mpReply.getMultipartReplyBody();
         MultipartReplyMeterConfig replyBody = caseBody.getMultipartReplyMeterConfig();
-        final Optional<List<MeterConfigStats>> meterConfigStatsList = ConvertorManager.getInstance().convert(replyBody.getMeterConfig());
+        final Optional<List<MeterConfigStats>> meterConfigStatsList = convertorExecutor.convert(replyBody.getMeterConfig(), data);
 
         message.setMeterConfigStats(meterConfigStatsList.orElse(Collections.emptyList()));
 
         listDataObject.add(message.build());
     }
 
-    private static void translateMeterFeatures(final List<DataObject> listDataObject,
+    private void translateMeterFeatures(final List<DataObject> listDataObject,
                                                final MultipartReplyMessage mpReply,
                                                final NodeId node) {
         if (!MultipartType.OFPMPMETERFEATURES.equals(mpReply.getType())) {
@@ -434,7 +440,7 @@ public class SinglePurposeMultipartReplyTranslator {
         listDataObject.add(message.build());
     }
 
-    private static void translateTable(final List<DataObject> listDataObject,
+    private void translateTable(final List<DataObject> listDataObject,
                                        final MultipartReplyMessage mpReply,
                                        final NodeId node) {
         if (!MultipartType.OFPMPTABLE.equals(mpReply.getType())) {
@@ -465,7 +471,7 @@ public class SinglePurposeMultipartReplyTranslator {
         listDataObject.add(message.build());
     }
 
-    private static void translateQueue(final List<DataObject> listDataObject,
+    private void translateQueue(final List<DataObject> listDataObject,
                                        final MultipartReplyMessage mpReply,
                                        final NodeId node,
                                        final OpenflowVersion ofVersion,
index 8fe6bb4b52edaa197a903d0ae4586addbb745671..b34e9529ed2bec2bbb7c8a8f517a092f969ad9ce 100644 (file)
@@ -40,6 +40,7 @@ import org.opendaylight.openflowplugin.impl.rpc.listener.ItemLifecycleListenerIm
 import org.opendaylight.openflowplugin.impl.services.RequestContextUtil;
 import org.opendaylight.openflowplugin.impl.statistics.services.dedicated.StatisticsGatheringOnTheFlyService;
 import org.opendaylight.openflowplugin.impl.statistics.services.dedicated.StatisticsGatheringService;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -56,6 +57,7 @@ class StatisticsContextImpl implements StatisticsContext {
     private final ListenableFuture<Boolean> emptyFuture;
     private final boolean shuttingDownStatisticsPolling;
     private final Object COLLECTION_STAT_TYPE_LOCK = new Object();
+    private final SinglePurposeMultipartReplyTranslator multipartReplyTranslator;
     @GuardedBy("COLLECTION_STAT_TYPE_LOCK")
     private List<MultipartType> collectingStatType;
 
@@ -66,13 +68,14 @@ class StatisticsContextImpl implements StatisticsContext {
     private volatile boolean schedulingEnabled;
     private volatile CONTEXT_STATE contextState;
 
-    StatisticsContextImpl(@CheckForNull final DeviceInfo deviceInfo, final boolean shuttingDownStatisticsPolling, final LifecycleConductor lifecycleConductor) {
+    StatisticsContextImpl(@CheckForNull final DeviceInfo deviceInfo, final boolean shuttingDownStatisticsPolling, final LifecycleConductor lifecycleConductor, final ConvertorExecutor convertorExecutor) {
         this.deviceContext = Preconditions.checkNotNull(lifecycleConductor.getDeviceContext(deviceInfo));
         this.devState = Preconditions.checkNotNull(deviceContext.getDeviceState());
         this.shuttingDownStatisticsPolling = shuttingDownStatisticsPolling;
+        multipartReplyTranslator = new SinglePurposeMultipartReplyTranslator(convertorExecutor);
         emptyFuture = Futures.immediateFuture(false);
         statisticsGatheringService = new StatisticsGatheringService(this, deviceContext);
-        statisticsGatheringOnTheFlyService = new StatisticsGatheringOnTheFlyService(this, deviceContext);
+        statisticsGatheringOnTheFlyService = new StatisticsGatheringOnTheFlyService(this, deviceContext, convertorExecutor);
         itemLifeCycleListener = new ItemLifecycleListenerImpl(deviceContext);
         statListForCollectingInitialization();
         contextState = CONTEXT_STATE.WORKING;
@@ -289,7 +292,7 @@ class StatisticsContextImpl implements StatisticsContext {
                 /*MultipartType.OFPMPFLOW*/ multipartType,
                 deviceContext,
                 deviceContext,
-                initial) : emptyFuture;
+                initial, multipartReplyTranslator) : emptyFuture;
     }
 
     private ListenableFuture<Boolean> collectTableStatistics(final MultipartType multipartType) {
@@ -299,7 +302,7 @@ class StatisticsContextImpl implements StatisticsContext {
                 /*MultipartType.OFPMPTABLE*/ multipartType,
                 deviceContext,
                 deviceContext,
-                false) : emptyFuture;
+                false, multipartReplyTranslator) : emptyFuture;
     }
 
     private ListenableFuture<Boolean> collectPortStatistics(final MultipartType multipartType) {
@@ -309,7 +312,7 @@ class StatisticsContextImpl implements StatisticsContext {
                 /*MultipartType.OFPMPPORTSTATS*/ multipartType,
                 deviceContext,
                 deviceContext,
-                false) : emptyFuture;
+                false, multipartReplyTranslator) : emptyFuture;
     }
 
     private ListenableFuture<Boolean> collectQueueStatistics(final MultipartType multipartType) {
@@ -319,7 +322,7 @@ class StatisticsContextImpl implements StatisticsContext {
                 /*MultipartType.OFPMPQUEUE*/ multipartType,
                 deviceContext,
                 deviceContext,
-                false);
+                false, multipartReplyTranslator);
     }
 
     private ListenableFuture<Boolean> collectGroupDescStatistics(final MultipartType multipartType) {
@@ -329,7 +332,7 @@ class StatisticsContextImpl implements StatisticsContext {
                 /*MultipartType.OFPMPGROUPDESC*/ multipartType,
                 deviceContext,
                 deviceContext,
-                false) : emptyFuture;
+                false, multipartReplyTranslator) : emptyFuture;
     }
 
     private ListenableFuture<Boolean> collectGroupStatistics(final MultipartType multipartType) {
@@ -339,7 +342,7 @@ class StatisticsContextImpl implements StatisticsContext {
                 /*MultipartType.OFPMPGROUP*/ multipartType,
                 deviceContext,
                 deviceContext,
-                false) : emptyFuture;
+                false, multipartReplyTranslator) : emptyFuture;
     }
 
     private ListenableFuture<Boolean> collectMeterConfigStatistics(final MultipartType multipartType) {
@@ -349,7 +352,7 @@ class StatisticsContextImpl implements StatisticsContext {
                 /*MultipartType.OFPMPMETERCONFIG*/ multipartType,
                 deviceContext,
                 deviceContext,
-                false) : emptyFuture;
+                false, multipartReplyTranslator) : emptyFuture;
     }
 
     private ListenableFuture<Boolean> collectMeterStatistics(final MultipartType multipartType) {
@@ -359,7 +362,7 @@ class StatisticsContextImpl implements StatisticsContext {
                 /*MultipartType.OFPMPMETER*/ multipartType,
                 deviceContext,
                 deviceContext,
-                false) : emptyFuture;
+                false, multipartReplyTranslator) : emptyFuture;
     }
 
     @VisibleForTesting
index ea0a7c6f4d653e73a710af25073284298ef8674b..b47dfee91359d53c4d2708f326e923585be30420 100644 (file)
@@ -119,7 +119,6 @@ public final class StatisticsGatheringUtils {
     private static String DATE_AND_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
 
     private static final Logger LOG = LoggerFactory.getLogger(StatisticsGatheringUtils.class);
-    private static final SinglePurposeMultipartReplyTranslator MULTIPART_REPLY_TRANSLATOR = new SinglePurposeMultipartReplyTranslator();
     private static final String QUEUE2_REQCTX = "QUEUE2REQCTX-";
 
     private StatisticsGatheringUtils() {
@@ -132,7 +131,8 @@ public final class StatisticsGatheringUtils {
                                                       final MultipartType type,
                                                       final TxFacade txFacade,
                                                       final DeviceRegistry registry,
-                                                      final Boolean initial) {
+                                                      final Boolean initial,
+                                                      final SinglePurposeMultipartReplyTranslator multipartReplyTranslator) {
         EventIdentifier wholeProcessEventIdentifier = null;
         if (MultipartType.OFPMPFLOW.equals(type)) {
             wholeProcessEventIdentifier = new EventIdentifier(type.toString(), deviceInfo.getNodeId().getValue());
@@ -142,7 +142,7 @@ public final class StatisticsGatheringUtils {
         final ListenableFuture<RpcResult<List<MultipartReply>>> statisticsDataInFuture =
                 JdkFutureAdapters.listenInPoolThread(statisticsGatheringService.getStatisticsOfType(
                         ofpQueuToRequestContextEventIdentifier, type));
-        return transformAndStoreStatisticsData(statisticsDataInFuture, deviceInfo, wholeProcessEventIdentifier, type, txFacade, registry, initial);
+        return transformAndStoreStatisticsData(statisticsDataInFuture, deviceInfo, wholeProcessEventIdentifier, type, txFacade, registry, initial, multipartReplyTranslator);
     }
 
     private static ListenableFuture<Boolean> transformAndStoreStatisticsData(final ListenableFuture<RpcResult<List<MultipartReply>>> statisticsDataInFuture,
@@ -151,7 +151,8 @@ public final class StatisticsGatheringUtils {
                                                                              final MultipartType type,
                                                                              final TxFacade txFacade,
                                                                              final DeviceRegistry registry,
-                                                                             final boolean initial) {
+                                                                             final boolean initial,
+                                                                             final SinglePurposeMultipartReplyTranslator multipartReplyTranslator) {
         return Futures.transform(statisticsDataInFuture, new AsyncFunction<RpcResult<List<MultipartReply>>, Boolean>() {
             @Nullable
             @Override
@@ -169,7 +170,7 @@ public final class StatisticsGatheringUtils {
 
                         try {
                             for (final MultipartReply singleReply : rpcResult.getResult()) {
-                                final List<? extends DataObject> multipartDataList = MULTIPART_REPLY_TRANSLATOR.translate(
+                                final List<? extends DataObject> multipartDataList = multipartReplyTranslator.translate(
                                         deviceInfo.getDatapathId(),
                                         deviceInfo.getVersion(), singleReply);
                                 multipartData = multipartDataList.get(0);
index 8aa3c7aa537d248bc8b58a1cb78991f180fc450b..8386755c855c15468c8efa4406a6ba2c2fd2573b 100644 (file)
@@ -40,6 +40,7 @@ import org.opendaylight.openflowplugin.api.openflow.lifecycle.LifecycleConductor
 import org.opendaylight.openflowplugin.api.openflow.rpc.ItemLifeCycleSource;
 import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext;
 import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.ChangeStatisticsWorkModeInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.GetStatisticsWorkModeOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.GetStatisticsWorkModeOutputBuilder;
@@ -56,6 +57,7 @@ public class StatisticsManagerImpl implements StatisticsManager, StatisticsManag
     private static final Logger LOG = LoggerFactory.getLogger(StatisticsManagerImpl.class);
 
     private static final long DEFAULT_STATS_TIMEOUT_SEC = 50L;
+    private final ConvertorExecutor convertorExecutor;
 
     private DeviceInitializationPhaseHandler deviceInitPhaseHandler;
     private DeviceTerminationPhaseHandler deviceTerminPhaseHandler;
@@ -80,7 +82,9 @@ public class StatisticsManagerImpl implements StatisticsManager, StatisticsManag
 
     public StatisticsManagerImpl(@CheckForNull final RpcProviderRegistry rpcProviderRegistry,
                                  final boolean shuttingDownStatisticsPolling,
-                                 final LifecycleConductor lifecycleConductor) {
+                                 final LifecycleConductor lifecycleConductor,
+                                 final ConvertorExecutor convertorExecutor) {
+        this.convertorExecutor = convertorExecutor;
         Preconditions.checkArgument(rpcProviderRegistry != null);
         this.controlServiceRegistration = Preconditions.checkNotNull(rpcProviderRegistry.addRpcImplementation(
                 StatisticsManagerControlService.class, this));
@@ -93,7 +97,7 @@ public class StatisticsManagerImpl implements StatisticsManager, StatisticsManag
 
         final DeviceContext deviceContext = Preconditions.checkNotNull(conductor.getDeviceContext(deviceInfo));
 
-        final StatisticsContext statisticsContext = new StatisticsContextImpl(deviceInfo, shuttingDownStatisticsPolling, conductor);
+        final StatisticsContext statisticsContext = new StatisticsContextImpl(deviceInfo, shuttingDownStatisticsPolling, conductor, convertorExecutor);
         Verify.verify(contexts.putIfAbsent(deviceInfo, statisticsContext) == null, "StatisticsCtx still not closed for Node {}", deviceInfo.getNodeId());
 
         deviceInitPhaseHandler.onDeviceContextLevelUp(deviceInfo);
index d49c00b6966fe3b60935089b2ae5602f6925da8b..caa24be942bf1815b0351f75e5f3f0900c86b4e7 100644 (file)
@@ -16,6 +16,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.FlowStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.util.FlowCreatorUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
@@ -33,10 +34,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 public final class AllFlowsInAllTablesService extends AbstractCompatibleStatService<GetAllFlowsStatisticsFromAllFlowTablesInput,
         GetAllFlowsStatisticsFromAllFlowTablesOutput, FlowsStatisticsUpdate> {
     private final MultipartRequestFlowCase flowCase;
+    private final ConvertorExecutor convertorExecutor;
 
     public AllFlowsInAllTablesService(final RequestContextStack requestContextStack, final DeviceContext deviceContext,
-                                      final AtomicLong compatibilityXidSeed) {
+                                      final AtomicLong compatibilityXidSeed, final ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, compatibilityXidSeed);
+        this.convertorExecutor = convertorExecutor;
 
         final MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
         final MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
@@ -67,6 +70,6 @@ public final class AllFlowsInAllTablesService extends AbstractCompatibleStatServ
 
     @Override
     public FlowsStatisticsUpdate transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
-        return FlowStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
+        return FlowStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
     }
 }
index cdd22569049220317bedb11bf974bbbdf9eea2b3..d7a4af5da35782cbb5dfb4c6c5dcf9b38b5cc39a 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.FlowStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.util.FlowCreatorUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
@@ -34,10 +35,12 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 public class AllFlowsInTableService extends AbstractCompatibleStatService<GetAllFlowStatisticsFromFlowTableInput,
         GetAllFlowStatisticsFromFlowTableOutput, FlowsStatisticsUpdate> {
 
+    private final ConvertorExecutor convertorExecutor;
     private Function<? super RpcResult<List<MultipartReply>>, FlowsStatisticsUpdate> transformer;
 
-    public AllFlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+    public AllFlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, compatibilityXidSeed);
+        this.convertorExecutor = convertorExecutor;
     }
 
     @Override
@@ -72,6 +75,6 @@ public class AllFlowsInTableService extends AbstractCompatibleStatService<GetAll
 
     @Override
     public FlowsStatisticsUpdate transformToNotification(List<MultipartReply> mpResult, TransactionId emulatedTxId) {
-        return FlowStatisticsToNotificationTransformer.transformToNotification(mpResult, getDeviceInfo(), getOfVersion(), emulatedTxId);
+        return FlowStatisticsToNotificationTransformer.transformToNotification(mpResult, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
     }
 }
index 5cf5db31ef1f61fb106178fa1185ffdf59181234..4c563dde03196afba06de62ea70049daa8863dfe 100644 (file)
@@ -16,6 +16,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.GroupStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
@@ -45,9 +46,12 @@ final class AllGroupsStatsService extends
         GROUP_CASE = caseBuilder.build();
     }
 
+    private final ConvertorExecutor convertorExecutor;
 
-    public AllGroupsStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+
+    public AllGroupsStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, compatibilityXidSeed);
+        this.convertorExecutor = convertorExecutor;
     }
 
 
@@ -71,6 +75,6 @@ final class AllGroupsStatsService extends
 
     @Override
     public GroupStatisticsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
-        return GroupStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), emulatedTxId);
+        return GroupStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), emulatedTxId, convertorExecutor);
     }
 }
index 4055b69f04a2fc4506081ada2b5752b5b375cc6a..19768808addff4e38b2a971e62894b6599adcb73 100644 (file)
@@ -17,7 +17,8 @@ import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
@@ -54,8 +55,13 @@ final class AllMeterConfigStatsService
         METER_CONFIG_CASE = caseBuilder.build();
     }
 
-    public AllMeterConfigStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+    private final ConvertorExecutor convertorExecutor;
+    private final VersionConvertorData data;
+
+    public AllMeterConfigStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, compatibilityXidSeed);
+        this.convertorExecutor = convertorExecutor;
+        data = new VersionConvertorData(getVersion());
     }
 
     @Override
@@ -82,7 +88,7 @@ final class AllMeterConfigStatsService
             MultipartReplyMeterConfigCase caseBody = (MultipartReplyMeterConfigCase) mpReply.getMultipartReplyBody();
             MultipartReplyMeterConfig replyBody = caseBody.getMultipartReplyMeterConfig();
 
-            final Optional<List<MeterConfigStats>> meterConfigStatsList = ConvertorManager.getInstance().convert(replyBody.getMeterConfig());
+            final Optional<List<MeterConfigStats>> meterConfigStatsList = convertorExecutor.convert(replyBody.getMeterConfig(), data);
 
             if (meterConfigStatsList.isPresent()) {
                 message.getMeterConfigStats().addAll(meterConfigStatsList.get());
index aae79faed6afe89965b3c65df720cd0fad6d2af2..2c47f1ec58c6109ef97eb8f6eab2042db9a16c7e 100644 (file)
@@ -16,6 +16,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.MeterStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutput;
@@ -46,8 +47,11 @@ final class AllMeterStatsService
         METER_CASE = caseBuilder.build();
     }
 
-    public AllMeterStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+    private final ConvertorExecutor convertorExecutor;
+
+    public AllMeterStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, compatibilityXidSeed);
+        this.convertorExecutor = convertorExecutor;
     }
 
     @Override
@@ -65,6 +69,6 @@ final class AllMeterStatsService
 
     @Override
     public MeterStatisticsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
-        return MeterStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
+        return MeterStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
     }
 }
index 12641266b037a07f1b69dd65abef784b2d103fe1..1bf30f6650d1106f00bc9e61c0ce7bc745db437a 100644 (file)
@@ -16,6 +16,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.FlowStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
@@ -32,8 +33,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 public final class FlowsInTableService extends AbstractCompatibleStatService<GetFlowStatisticsFromFlowTableInput,
         GetFlowStatisticsFromFlowTableOutput, FlowsStatisticsUpdate> {
 
-    public FlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+    private final ConvertorExecutor convertorExecutor;
+
+    public FlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, compatibilityXidSeed);
+        this.convertorExecutor = convertorExecutor;
     }
 
     @Override
@@ -73,7 +77,7 @@ public final class FlowsInTableService extends AbstractCompatibleStatService<Get
 
         // convert and inject match
         final short version = getVersion();
-        MatchReactor.getInstance().convert(input.getMatch(), version, mprFlowRequestBuilder);
+        MatchReactor.getInstance().convert(input.getMatch(), version, mprFlowRequestBuilder, convertorExecutor);
 
         // Set request body to main multipart request
         multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
@@ -91,6 +95,6 @@ public final class FlowsInTableService extends AbstractCompatibleStatService<Get
 
     @Override
     public FlowsStatisticsUpdate transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
-        return FlowStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
+        return FlowStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
     }
 }
index f52eb469f3f6025ca962d5cb1935217e6f8b2139..1858309ae3298e7ac7d71694c2c842fed900347b 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInput;
@@ -37,9 +37,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 final class GroupDescriptionService
         extends AbstractCompatibleStatService<GetGroupDescriptionInput, GetGroupDescriptionOutput, GroupDescStatsUpdated> {
     private static final MultipartRequestGroupDescCase GROUP_DESC_CASE = new MultipartRequestGroupDescCaseBuilder().build();
+    private final ConvertorExecutor convertorExecutor;
 
-    public GroupDescriptionService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+    public GroupDescriptionService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, compatibilityXidSeed);
+        this.convertorExecutor = convertorExecutor;
     }
 
     @Override
@@ -68,7 +70,7 @@ final class GroupDescriptionService
         for (MultipartReply mpReply : result) {
             MultipartReplyGroupDescCase caseBody = (MultipartReplyGroupDescCase) mpReply.getMultipartReplyBody();
             MultipartReplyGroupDesc replyBody = caseBody.getMultipartReplyGroupDesc();
-            final Optional<List<GroupDescStats>> groupDescStatsList = ConvertorManager.getInstance().convert(
+            final Optional<List<GroupDescStats>> groupDescStatsList = convertorExecutor.convert(
                     replyBody.getGroupDesc(), data);
 
             if (groupDescStatsList.isPresent()) {
index 77ec5014cc1ff689413de02781d333f9eaae81d0..edb78d16ce31c3a2fdf82cdbd0a659adc3e711ec 100644 (file)
@@ -15,6 +15,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.GroupStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutput;
@@ -31,8 +32,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 final class GroupStatsService
         extends AbstractCompatibleStatService<GetGroupStatisticsInput, GetGroupStatisticsOutput, GroupStatisticsUpdated> {
 
-    public GroupStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+    private final ConvertorExecutor convertorExecutor;
+
+    public GroupStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, compatibilityXidSeed);
+        this.convertorExecutor = convertorExecutor;
     }
 
     @Override
@@ -56,6 +60,6 @@ final class GroupStatsService
 
     @Override
     public GroupStatisticsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
-        return GroupStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), emulatedTxId);
+        return GroupStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), emulatedTxId, convertorExecutor);
     }
 }
index f7050395c8499a4cc8bbd4a28b1e276da9a5021f..5e013172047008dabc9cb64c02043388ff3f2a9d 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.services.AbstractMultipartService;
 import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
 import org.opendaylight.openflowplugin.openflow.md.util.FlowCreatorUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
@@ -25,8 +26,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 
 final class MatchingFlowsInTableService extends AbstractMultipartService<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput> {
 
-    public MatchingFlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+    private final ConvertorExecutor convertorExecutor;
+
+    public MatchingFlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext);
+        this.convertorExecutor = convertorExecutor;
     }
 
     @Override
@@ -60,7 +64,7 @@ final class MatchingFlowsInTableService extends AbstractMultipartService<GetAggr
             mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
         }
 
-        MatchReactor.getInstance().convert(input.getMatch(), version, mprAggregateRequestBuilder);
+        MatchReactor.getInstance().convert(input.getMatch(), version, mprAggregateRequestBuilder, convertorExecutor);
 
         FlowCreatorUtil.setWildcardedFlowMatch(version, mprAggregateRequestBuilder);
 
index 841adf203903edf7c5bceb7df119f0c193bd8544..d7c0ec0209bc29cb66467cb3c5ebf9937826e82a 100644 (file)
@@ -15,6 +15,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.MeterStatisticsToNotificationTransformer;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsOutput;
@@ -31,8 +32,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 final class MeterStatsService
         extends AbstractCompatibleStatService<GetMeterStatisticsInput, GetMeterStatisticsOutput, MeterStatisticsUpdated> {
 
-    public MeterStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+    private final ConvertorExecutor convertorExecutor;
+
+    public MeterStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, compatibilityXidSeed);
+        this.convertorExecutor = convertorExecutor;
     }
 
     @Override
@@ -57,6 +61,6 @@ final class MeterStatsService
 
     @Override
     public MeterStatisticsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
-        return MeterStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
+        return MeterStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
     }
 }
index d028ad976cb9734697e9ca1be0edd8f0eb34d1f6..3ab8c8b21af044805919b78706c1ffe4a54fbefe 100644 (file)
@@ -19,6 +19,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary;
 import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
 import org.opendaylight.openflowplugin.api.openflow.statistics.compatibility.Delegator;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
@@ -86,13 +87,13 @@ public class OpendaylightFlowStatisticsServiceImpl implements OpendaylightFlowSt
     private OpendaylightFlowStatisticsService delegate;
 
     public static OpendaylightFlowStatisticsServiceImpl createWithOook(final RequestContextStack requestContextStack,
-                                                              final DeviceContext deviceContext) {
-        return new OpendaylightFlowStatisticsServiceImpl(requestContextStack, deviceContext, deviceContext.oook());
+                                                              final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
+        return new OpendaylightFlowStatisticsServiceImpl(requestContextStack, deviceContext, deviceContext.oook(), convertorExecutor);
     }
 
     public OpendaylightFlowStatisticsServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext,
-                                                 final TranslatorLibrary translatorLibrary) {
-        matchingFlowsInTable = new MatchingFlowsInTableService(requestContextStack, deviceContext);
+                                                 final TranslatorLibrary translatorLibrary, final ConvertorExecutor convertorExecutor) {
+        matchingFlowsInTable = new MatchingFlowsInTableService(requestContextStack, deviceContext, convertorExecutor);
         this.translatorLibrary = translatorLibrary;
     }
 
index 28eaa8f0230280206590e1c6ae55688e70a31906..b428aa7182992b1128d1601db6d45bfa2ba7f7fe 100644 (file)
@@ -12,6 +12,7 @@ import java.util.concurrent.atomic.AtomicLong;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInput;
@@ -35,12 +36,13 @@ public class OpendaylightGroupStatisticsServiceImpl implements OpendaylightGroup
 
     public OpendaylightGroupStatisticsServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext,
                                                   final AtomicLong compatibilityXidSeed,
-                                                  final NotificationPublishService notificationPublishService) {
+                                                  final NotificationPublishService notificationPublishService,
+                                                  final ConvertorExecutor convertorExecutor) {
         this.notificationPublishService = notificationPublishService;
-        allGroups = new AllGroupsStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
-        groupDesc = new GroupDescriptionService(requestContextStack, deviceContext, compatibilityXidSeed);
+        allGroups = new AllGroupsStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
+        groupDesc = new GroupDescriptionService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
         groupFeat = new GroupFeaturesService(requestContextStack, deviceContext, compatibilityXidSeed);
-        groupStats = new GroupStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
+        groupStats = new GroupStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
     }
 
     @Override
index 22f74d27672f5eea4c5bb0a9134a640085e1dc8e..4087e88282ccbb1f57d61c74f54b35862cb98763 100644 (file)
@@ -12,6 +12,7 @@ import java.util.concurrent.atomic.AtomicLong;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInput;
@@ -33,13 +34,14 @@ public class OpendaylightMeterStatisticsServiceImpl implements OpendaylightMeter
     public OpendaylightMeterStatisticsServiceImpl(final RequestContextStack requestContextStack,
                                                   final DeviceContext deviceContext,
                                                   final AtomicLong compatibilityXidSeed,
-                                                  final NotificationPublishService notificationPublishService) {
+                                                  final NotificationPublishService notificationPublishService,
+                                                  final ConvertorExecutor convertorExecutor) {
         this.notificationPublishService = notificationPublishService;
 
-        allMeterConfig = new AllMeterConfigStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
-        allMeterStats = new AllMeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
+        allMeterConfig = new AllMeterConfigStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
+        allMeterStats = new AllMeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
         meterFeatures = new MeterFeaturesService(requestContextStack, deviceContext, compatibilityXidSeed);
-        meterStats = new MeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
+        meterStats = new MeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
     }
 
     @Override
index 27a7c6039c7eefb790059fc2b389cebb8f3a072f..3b4605959d78766195a3d083855f5ac4357c3906 100644 (file)
@@ -14,7 +14,7 @@ import java.util.List;
 import java.util.Optional;
 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.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdateBuilder;
@@ -34,12 +34,14 @@ public class FlowStatisticsToNotificationTransformer {
      * @param deviceInfo   device state
      * @param ofVersion     device version
      * @param emulatedTxId
+     * @param convertorExecutor
      * @return notification containing flow stats
      */
     public static FlowsStatisticsUpdate transformToNotification(final List<MultipartReply> mpResult,
                                                                 final DeviceInfo deviceInfo,
                                                                 final OpenflowVersion ofVersion,
-                                                                final TransactionId emulatedTxId) {
+                                                                final TransactionId emulatedTxId,
+                                                                final ConvertorExecutor convertorExecutor) {
         final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(ofVersion.getVersion());
         data.setDatapathId(deviceInfo.getDatapathId());
         final FlowsStatisticsUpdateBuilder notification = new FlowsStatisticsUpdateBuilder();
@@ -55,7 +57,7 @@ public class FlowStatisticsToNotificationTransformer {
             MultipartReplyFlowCase caseBody = (MultipartReplyFlowCase) mpRawReply.getMultipartReplyBody();
             MultipartReplyFlow replyBody = caseBody.getMultipartReplyFlow();
             final Optional<List<FlowAndStatisticsMapList>> outStatsItem =
-                    ConvertorManager.getInstance().convert(replyBody.getFlowStats(), data);
+                    convertorExecutor.convert(replyBody.getFlowStats(), data);
 
 
             if (outStatsItem.isPresent()) {
index bf476ad6596796ca891ac290083128ff7d917f26..39bbfeb6d40193ec13ee6ddfc4cb47bd73153730 100644 (file)
@@ -12,7 +12,8 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdatedBuilder;
@@ -29,12 +30,15 @@ public class GroupStatisticsToNotificationTransformer {
      * @param mpReplyList   raw multipart response from device
      * @param deviceInfo   device state
      * @param emulatedTxId
+     * @param convertorExecutor
      * @return notification containing flow stats
      */
     public static GroupStatisticsUpdated transformToNotification(final List<MultipartReply> mpReplyList,
                                                                  final DeviceInfo deviceInfo,
-                                                                 final TransactionId emulatedTxId) {
+                                                                 final TransactionId emulatedTxId,
+                                                                 final ConvertorExecutor convertorExecutor) {
 
+        VersionConvertorData data = new VersionConvertorData(deviceInfo.getVersion());
         GroupStatisticsUpdatedBuilder notification = new GroupStatisticsUpdatedBuilder();
         notification.setId(deviceInfo.getNodeId());
         notification.setMoreReplies(Boolean.FALSE);
@@ -45,8 +49,8 @@ public class GroupStatisticsToNotificationTransformer {
         for (MultipartReply mpReply : mpReplyList) {
             MultipartReplyGroupCase caseBody = (MultipartReplyGroupCase) mpReply.getMultipartReplyBody();
             MultipartReplyGroup replyBody = caseBody.getMultipartReplyGroup();
-            final Optional<List<GroupStats>> groupStatsList = ConvertorManager.getInstance().convert(
-                    replyBody.getGroupStats());
+            final Optional<List<GroupStats>> groupStatsList = convertorExecutor.convert(
+                    replyBody.getGroupStats(), data);
 
             if (groupStatsList.isPresent()) {
                 notification.getGroupStats().addAll(groupStatsList.get());
index 8f15ba34cc32c2130ea9be81603440cd02d8d4ac..375fd6687274dbf033365bc1e3423ae3a1d1591a 100644 (file)
@@ -13,7 +13,8 @@ import java.util.List;
 import java.util.Optional;
 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.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterStatisticsUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterStatisticsUpdatedBuilder;
@@ -32,13 +33,16 @@ public class MeterStatisticsToNotificationTransformer {
      * @param deviceInfo   device state
      * @param ofVersion     device version
      * @param emulatedTxId
+     * @param convertorExecutor
      * @return notification containing flow stats
      */
     public static MeterStatisticsUpdated transformToNotification(final List<MultipartReply> mpReplyList,
                                                                  final DeviceInfo deviceInfo,
                                                                  final OpenflowVersion ofVersion,
-                                                                 final TransactionId emulatedTxId) {
+                                                                 final TransactionId emulatedTxId,
+                                                                 final ConvertorExecutor convertorExecutor) {
 
+        VersionConvertorData data = new VersionConvertorData(deviceInfo.getVersion());
         MeterStatisticsUpdatedBuilder notification = new MeterStatisticsUpdatedBuilder();
         notification.setId(deviceInfo.getNodeId());
         notification.setMoreReplies(Boolean.FALSE);
@@ -48,7 +52,7 @@ public class MeterStatisticsToNotificationTransformer {
         for (MultipartReply mpReply : mpReplyList) {
             MultipartReplyMeterCase caseBody = (MultipartReplyMeterCase) mpReply.getMultipartReplyBody();
             MultipartReplyMeter replyBody = caseBody.getMultipartReplyMeter();
-            final Optional<List<MeterStats>> meterStatsList = ConvertorManager.getInstance().convert(replyBody.getMeterStats());
+            final Optional<List<MeterStats>> meterStatsList = convertorExecutor.convert(replyBody.getMeterStats(), data);
 
             if (meterStatsList.isPresent()) {
                 notification.getMeterStats().addAll(meterStatsList.get());
index 199afcaccbf4f04ef4a2c6a817ddafbc43b1b9de..afd42d2e0f544f4c6ac4bd05e84ee824a24d79cf 100644 (file)
@@ -16,6 +16,7 @@ import org.opendaylight.openflowplugin.impl.statistics.services.AggregateFlowsIn
 import org.opendaylight.openflowplugin.impl.statistics.services.AllFlowsInAllTablesService;
 import org.opendaylight.openflowplugin.impl.statistics.services.AllFlowsInTableService;
 import org.opendaylight.openflowplugin.impl.statistics.services.FlowsInTableService;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
@@ -47,12 +48,13 @@ public class OpendaylightFlowStatisticsServiceDelegateImpl implements Opendaylig
     public OpendaylightFlowStatisticsServiceDelegateImpl(final RequestContextStack requestContextStack,
                                                          final DeviceContext deviceContext,
                                                          final NotificationPublishService notificationService,
-                                                         final AtomicLong compatibilityXidSeed) {
+                                                         final AtomicLong compatibilityXidSeed,
+                                                         final ConvertorExecutor convertorExecutor) {
         this.notificationService = notificationService;
         aggregateFlowsInTable = AggregateFlowsInTableService.createWithOook(requestContextStack, deviceContext, compatibilityXidSeed);
-        allFlowsInAllTables = new AllFlowsInAllTablesService(requestContextStack, deviceContext, compatibilityXidSeed);
-        allFlowsInTable = new AllFlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed);
-        flowsInTable = new FlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed);
+        allFlowsInAllTables = new AllFlowsInAllTablesService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
+        allFlowsInTable = new AllFlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
+        flowsInTable = new FlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
     }
 
     /**
index 60f7b03f29dcfcd03314392bcfbeae6534f7e372..1ba77a309bc04dfa0264a4c4df0dfdea41221875 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.Stati
 import org.opendaylight.openflowplugin.impl.common.MultipartRequestInputFactory;
 import org.opendaylight.openflowplugin.impl.services.AbstractMultipartOnTheFlyService;
 import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.EventsTimeCounter;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 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.OfHeader;
@@ -32,8 +33,8 @@ public class StatisticsGatheringOnTheFlyService extends AbstractMultipartOnTheFl
 
     private static final Logger LOG = LoggerFactory.getLogger(StatisticsGatheringOnTheFlyService.class);
 
-    public StatisticsGatheringOnTheFlyService(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
-        super(requestContextStack, deviceContext);
+    public StatisticsGatheringOnTheFlyService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
+        super(requestContextStack, deviceContext, convertorExecutor);
     }
 
     @Override
index 9c200a990a90e0277ed149f0fad0ce1eba8ad837..156c34a0cdefab96376ef45eca564ceb75084fb0 100644 (file)
@@ -22,6 +22,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
 import org.opendaylight.openflowplugin.impl.services.AbstractMultipartService;
 import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.StoreStatsGrouping;
 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;
@@ -67,18 +68,25 @@ public abstract class AbstractDirectStatisticsService<I extends StoreStatsGroupi
             };
 
     private final MultipartType multipartType;
+    private final ConvertorExecutor convertorExecutor;
     private final OpenflowVersion ofVersion = OpenflowVersion.get(getVersion());
-
     /**
      * Instantiates a new Abstract direct statistics service.
      *
      * @param multipartType       the multipart type
      * @param requestContextStack the request context stack
      * @param deviceContext       the device context
+     * @param convertorExecutor
      */
-    protected AbstractDirectStatisticsService(MultipartType multipartType, RequestContextStack requestContextStack, DeviceContext deviceContext) {
+    protected AbstractDirectStatisticsService(MultipartType multipartType, RequestContextStack requestContextStack,
+                                              DeviceContext deviceContext, ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext);
         this.multipartType = multipartType;
+        this.convertorExecutor = convertorExecutor;
+    }
+
+    protected ConvertorExecutor getConvertorExecutor() {
+        return convertorExecutor;
     }
 
     /**
index 06fc3c123ebadd2104465a4311957f98c82b349d..81d8b887aa357e0d120f07cd7f3ab8fb35f61ae5 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKey;
 import org.opendaylight.openflowplugin.impl.registry.flow.FlowRegistryKeyFactory;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput;
@@ -49,14 +49,18 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  * The Flow direct statistics service.
  */
 public class FlowDirectStatisticsService extends AbstractDirectStatisticsService<GetFlowStatisticsInput, GetFlowStatisticsOutput> {
+    private final VersionDatapathIdConvertorData data;
+
     /**
      * Instantiates a new Flow direct statistics service.
-     *
-     * @param requestContextStack the request context stack
+     *  @param requestContextStack the request context stack
      * @param deviceContext       the device context
+     * @param convertorExecutor
      */
-    public FlowDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext) {
-        super(MultipartType.OFPMPFLOW, requestContextStack, deviceContext);
+    public FlowDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext, ConvertorExecutor convertorExecutor) {
+        super(MultipartType.OFPMPFLOW, requestContextStack, deviceContext, convertorExecutor);
+        data = new VersionDatapathIdConvertorData(getVersion());
+        data.setDatapathId(getDatapathId());
     }
 
     @Override
@@ -93,7 +97,7 @@ public class FlowDirectStatisticsService extends AbstractDirectStatisticsService
             mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
         }
 
-        MatchReactor.getInstance().convert(input.getMatch(), getVersion(), mprFlowRequestBuilder);
+        MatchReactor.getInstance().convert(input.getMatch(), getVersion(), mprFlowRequestBuilder, getConvertorExecutor());
 
         return new MultipartRequestFlowCaseBuilder()
                 .setMultipartRequestFlow(mprFlowRequestBuilder.build())
@@ -103,14 +107,12 @@ public class FlowDirectStatisticsService extends AbstractDirectStatisticsService
     @Override
     protected GetFlowStatisticsOutput buildReply(List<MultipartReply> input, boolean success) {
         final List<FlowAndStatisticsMapList> statsList = new ArrayList<>();
-        final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
-        data.setDatapathId(getDatapathId());
 
         if (success) {
             for (final MultipartReply mpReply : input) {
                 final MultipartReplyFlowCase caseBody = (MultipartReplyFlowCase) mpReply.getMultipartReplyBody();
                 final MultipartReplyFlow replyBody = caseBody.getMultipartReplyFlow();
-                final Optional<List<FlowAndStatisticsMapList>> statsListPart = ConvertorManager.getInstance().convert(
+                final Optional<List<FlowAndStatisticsMapList>> statsListPart = getConvertorExecutor().convert(
                         replyBody.getFlowStats(), data);
 
                 if (statsListPart.isPresent()) {
index 7037656e77f55fb9b88d49cfc2d96a8f2d1fc510..9a4925c8a95a42bcd2a3e0ff285130d22543cc9b 100644 (file)
@@ -15,7 +15,8 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetGroupStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetGroupStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetGroupStatisticsOutputBuilder;
@@ -40,14 +41,17 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  * The Group direct statistics service.
  */
 public class GroupDirectStatisticsService extends AbstractDirectStatisticsService<GetGroupStatisticsInput, GetGroupStatisticsOutput> {
+    private final VersionConvertorData data;
+
     /**
      * Instantiates a new Group direct statistics service.
-     *
-     * @param requestContextStack the request context stack
+     *  @param requestContextStack the request context stack
      * @param deviceContext       the device context
+     * @param convertorExecutor
      */
-    public GroupDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext) {
-        super(MultipartType.OFPMPGROUP, requestContextStack, deviceContext);
+    public GroupDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext, ConvertorExecutor convertorExecutor) {
+        super(MultipartType.OFPMPGROUP, requestContextStack, deviceContext, convertorExecutor);
+        data = new VersionConvertorData(getVersion());
     }
 
     @Override
@@ -73,8 +77,8 @@ public class GroupDirectStatisticsService extends AbstractDirectStatisticsServic
             for (final MultipartReply mpReply : input) {
                 final MultipartReplyGroupCase caseBody = (MultipartReplyGroupCase) mpReply.getMultipartReplyBody();
                 final MultipartReplyGroup replyBody = caseBody.getMultipartReplyGroup();
-                final Optional<List<GroupStats>> groupStatsList = ConvertorManager.getInstance().convert(
-                        replyBody.getGroupStats());
+                final Optional<List<GroupStats>> groupStatsList = getConvertorExecutor().convert(
+                        replyBody.getGroupStats(), data);
 
                 if (groupStatsList.isPresent()) {
                     groupStats.addAll(groupStatsList.get());
index c67d126f453c194f95882534c1266b0e0fb93d9e..1e1146d711812a82ce309700502015a97d12242a 100644 (file)
@@ -15,7 +15,8 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 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.direct.statistics.rev160511.GetMeterStatisticsOutputBuilder;
@@ -40,14 +41,17 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  * The Meter direct statistics service.
  */
 public class MeterDirectStatisticsService extends AbstractDirectStatisticsService<GetMeterStatisticsInput, GetMeterStatisticsOutput> {
+    private final VersionConvertorData data;
+
     /**
      * Instantiates a new Meter direct statistics service.
-     *
-     * @param requestContextStack the request context stack
+     *  @param requestContextStack the request context stack
      * @param deviceContext       the device context
+     * @param convertorExecutor
      */
-    public MeterDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext) {
-        super(MultipartType.OFPMPMETER, requestContextStack, deviceContext);
+    public MeterDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext, ConvertorExecutor convertorExecutor) {
+        super(MultipartType.OFPMPMETER, requestContextStack, deviceContext, convertorExecutor);
+        data = new VersionConvertorData(getVersion());
     }
 
     @Override
@@ -73,7 +77,7 @@ public class MeterDirectStatisticsService extends AbstractDirectStatisticsServic
             for (final MultipartReply mpReply : input) {
                 final MultipartReplyMeterCase caseBody = (MultipartReplyMeterCase) mpReply.getMultipartReplyBody();
                 final MultipartReplyMeter replyBody = caseBody.getMultipartReplyMeter();
-                final Optional<List<MeterStats>> meterStatsList = ConvertorManager.getInstance().convert(replyBody.getMeterStats());
+                final Optional<List<MeterStats>> meterStatsList = getConvertorExecutor().convert(replyBody.getMeterStats(), data);
 
                 if (meterStatsList.isPresent()) {
                     meterStats.addAll(meterStatsList.get());
index 6f8017100a3ddb02496b6645911ca3053df6d52b..2efa1cf3493e30c410f9c94c763eef68b22ab3fb 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsInput;
@@ -48,12 +49,12 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 public class NodeConnectorDirectStatisticsService extends AbstractDirectStatisticsService<GetNodeConnectorStatisticsInput, GetNodeConnectorStatisticsOutput> {
     /**
      * Instantiates a new Node connector direct statistics service.
-     *
-     * @param requestContextStack the request context stack
+     *  @param requestContextStack the request context stack
      * @param deviceContext       the device context
+     * @param convertorExecutor
      */
-    public NodeConnectorDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext) {
-        super(MultipartType.OFPMPPORTSTATS, requestContextStack, deviceContext);
+    public NodeConnectorDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext, ConvertorExecutor convertorExecutor) {
+        super(MultipartType.OFPMPPORTSTATS, requestContextStack, deviceContext, convertorExecutor);
     }
 
     @Override
index dd0d136c6504c619cf8870e0b69695b7812d320e..9ebbece5865bceeca47d9aa8c1b5d8ba91aef369 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
 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;
@@ -51,12 +52,12 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 public class QueueDirectStatisticsService extends AbstractDirectStatisticsService<GetQueueStatisticsInput, GetQueueStatisticsOutput> {
     /**
      * Instantiates a new Queue direct statistics service.
-     *
-     * @param requestContextStack the request context stack
+     *  @param requestContextStack the request context stack
      * @param deviceContext       the device context
+     * @param convertorExecutor
      */
-    public QueueDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext) {
-        super(MultipartType.OFPMPQUEUE, requestContextStack, deviceContext);
+    public QueueDirectStatisticsService(RequestContextStack requestContextStack, DeviceContext deviceContext, ConvertorExecutor convertorExecutor) {
+        super(MultipartType.OFPMPQUEUE, requestContextStack, deviceContext, convertorExecutor);
     }
 
     @Override
index c72a6b79e2b845ad4852359378192680fe9f3a7f..eb9ff12296554045022cffdf270f6c08fc0be45f 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.openflowplugin.impl.translator;
 import java.util.Optional;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
@@ -22,6 +22,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  * translate {@link FlowRemoved} message to FlowRemoved notification (omit instructions)
  */
 public class FlowRemovedTranslator implements MessageTranslator<FlowRemoved, org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved> {
+    private final ConvertorExecutor convertorExecutor;
+
+    public FlowRemovedTranslator(ConvertorExecutor convertorExecutor) {
+        this.convertorExecutor = convertorExecutor;
+    }
+
+    protected ConvertorExecutor getConvertorExecutor() {
+        return convertorExecutor;
+    }
 
     @Override
     public org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved translate(FlowRemoved input, DeviceInfo deviceInfo, Object connectionDistinguisher) {
@@ -39,7 +48,7 @@ public class FlowRemovedTranslator implements MessageTranslator<FlowRemoved, org
         final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(deviceInfo.getVersion());
         datapathIdConvertorData.setDatapathId(deviceInfo.getDatapathId());
 
-        final Optional<MatchBuilder> matchBuilderOptional = ConvertorManager.getInstance().convert(
+        final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(
                 flowRemoved.getMatch(),
                 datapathIdConvertorData);
 
index d4685e0738492f3ed00474fa1534564c274ec3eb..997321dfac858abe94f6898d68eaf64017e94f6b 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.openflowplugin.impl.translator;
 
 import java.util.Optional;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved;
@@ -20,12 +20,16 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  */
 public class FlowRemovedV10Translator extends FlowRemovedTranslator {
 
+    public FlowRemovedV10Translator(ConvertorExecutor convertorExecutor) {
+        super(convertorExecutor);
+    }
+
     @Override
     protected MatchBuilder translateMatch(FlowRemoved flowRemoved, DeviceInfo deviceInfo) {
         final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(deviceInfo.getVersion());
         datapathIdConvertorData.setDatapathId(deviceInfo.getDatapathId());
 
-        final Optional<MatchBuilder> matchBuilderOptional = ConvertorManager.getInstance().convert(
+        final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(
                 flowRemoved.getMatchV10(),
                 datapathIdConvertorData);
 
index b7e1a8bed07ec2a47ba012c6e498f778c31a6afc..f37474da379e7a25ec342c6dd0f0f6dcc87d4c6a 100644 (file)
@@ -18,7 +18,7 @@ import org.opendaylight.openflowplugin.extension.api.AugmentTuple;
 import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
 import org.opendaylight.openflowplugin.impl.util.NodeConnectorRefToPortTranslator;
 import org.opendaylight.openflowplugin.openflow.md.core.extension.MatchExtensionHelper;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.PacketInUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
@@ -33,6 +33,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Table
  * Created by tkubas on 4/1/15.
  */
 public class PacketReceivedTranslator implements MessageTranslator<PacketInMessage, PacketReceived> {
+    private final ConvertorExecutor convertorExecutor;
+
+    public PacketReceivedTranslator(ConvertorExecutor convertorExecutor) {
+        this.convertorExecutor = convertorExecutor;
+    }
+
     @Override
     public PacketReceived translate(final PacketInMessage input, final DeviceInfo deviceInfo, final Object connectionDistinguisher) {
 
@@ -73,11 +79,11 @@ public class PacketReceivedTranslator implements MessageTranslator<PacketInMessa
     }
 
     @VisibleForTesting
-    static org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match getPacketInMatch(final PacketInMessage input, final BigInteger datapathId) {
+    org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match getPacketInMatch(final PacketInMessage input, final BigInteger datapathId) {
         final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(input.getVersion());
         datapathIdConvertorData.setDatapathId(datapathId);
 
-        final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder> matchOptional = ConvertorManager.getInstance().convert(input.getMatch(), datapathIdConvertorData);
+        final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder> matchOptional = convertorExecutor.convert(input.getMatch(), datapathIdConvertorData);
         final MatchBuilder matchBuilder = matchOptional.isPresent() ?
                 new MatchBuilder(matchOptional.get().build()) :
                 new MatchBuilder();
index ec8930f4730d725a3983c57a0ed408af917a6ea9..ab7d8a6ce1f9f46314b484f08cad33c07e3bb056 100644 (file)
@@ -39,6 +39,7 @@ import org.opendaylight.openflowplugin.impl.common.NodeStaticReplyTranslatorUtil
 import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
@@ -93,9 +94,10 @@ public class DeviceInitializationUtils {
      *
      * @param deviceContext
      * @param switchFeaturesMandatory
+     * @param convertorExecutor
      * @return future - recommended to have blocking call for this future
      */
-    public static ListenableFuture<Void> initializeNodeInformation(final DeviceContext deviceContext, final boolean switchFeaturesMandatory) {
+    public static ListenableFuture<Void> initializeNodeInformation(final DeviceContext deviceContext, final boolean switchFeaturesMandatory, final ConvertorExecutor convertorExecutor) {
         Preconditions.checkArgument(deviceContext != null);
         final DeviceState deviceState = Preconditions.checkNotNull(deviceContext.getDeviceState());
         final DeviceInfo deviceInfo = deviceContext.getDeviceInfo();
@@ -144,7 +146,7 @@ public class DeviceInitializationUtils {
             final Capabilities capabilities = connectionContext.getFeatures().getCapabilities();
             LOG.debug("Setting capabilities for device {}", deviceInfo.getNodeId());
             DeviceStateUtil.setDeviceStateBasedOnV13Capabilities(deviceState, capabilities);
-            deviceFeaturesFuture = createDeviceFeaturesForOF13(deviceContext, deviceState, switchFeaturesMandatory);
+            deviceFeaturesFuture = createDeviceFeaturesForOF13(deviceContext, switchFeaturesMandatory, convertorExecutor);
         } else {
             deviceFeaturesFuture = Futures.immediateFailedFuture(new ConnectionException("Unsupported version "
                     + version));
@@ -192,7 +194,7 @@ public class DeviceInitializationUtils {
     }
 
     private static ListenableFuture<List<RpcResult<List<MultipartReply>>>> createDeviceFeaturesForOF13(
-            final DeviceContext deviceContext, final DeviceState deviceState, final boolean switchFeaturesMandatory) {
+            final DeviceContext deviceContext, final boolean switchFeaturesMandatory, final ConvertorExecutor convertorExecutor) {
 
         final ListenableFuture<RpcResult<List<MultipartReply>>> replyDesc = getNodeStaticInfo(MultipartType.OFPMPDESC,
                 deviceContext, deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), deviceContext.getDeviceInfo().getVersion());
@@ -205,32 +207,32 @@ public class DeviceInitializationUtils {
                             final RpcResult<List<MultipartReply>> rpcResult) throws Exception {
 
                         translateAndWriteReply(MultipartType.OFPMPDESC, deviceContext,
-                                deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), rpcResult.getResult());
+                                deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), rpcResult.getResult(), convertorExecutor);
 
                         final ListenableFuture<RpcResult<List<MultipartReply>>> replyMeterFeature = getNodeStaticInfo(
                                 MultipartType.OFPMPMETERFEATURES, deviceContext,
                                 deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), deviceContext.getDeviceInfo().getVersion());
 
                         createSuccessProcessingCallback(MultipartType.OFPMPMETERFEATURES, deviceContext,
-                                deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyMeterFeature);
+                                deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyMeterFeature, convertorExecutor);
 
                         final ListenableFuture<RpcResult<List<MultipartReply>>> replyGroupFeatures = getNodeStaticInfo(
                                 MultipartType.OFPMPGROUPFEATURES, deviceContext,
                                 deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), deviceContext.getDeviceInfo().getVersion());
                         createSuccessProcessingCallback(MultipartType.OFPMPGROUPFEATURES, deviceContext,
-                                deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyGroupFeatures);
+                                deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyGroupFeatures, convertorExecutor);
 
                         final ListenableFuture<RpcResult<List<MultipartReply>>> replyTableFeatures = getNodeStaticInfo(
                                 MultipartType.OFPMPTABLEFEATURES, deviceContext,
                                 deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), deviceContext.getDeviceInfo().getVersion());
                         createSuccessProcessingCallback(MultipartType.OFPMPTABLEFEATURES, deviceContext,
-                                deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyTableFeatures);
+                                deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyTableFeatures, convertorExecutor);
 
                         final ListenableFuture<RpcResult<List<MultipartReply>>> replyPortDescription = getNodeStaticInfo(
                                 MultipartType.OFPMPPORTDESC, deviceContext, deviceContext.getDeviceInfo().getNodeInstanceIdentifier(),
                                 deviceContext.getDeviceInfo().getVersion());
                         createSuccessProcessingCallback(MultipartType.OFPMPPORTDESC, deviceContext,
-                                deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyPortDescription);
+                                deviceContext.getDeviceInfo().getNodeInstanceIdentifier(), replyPortDescription, convertorExecutor);
                         if (switchFeaturesMandatory) {
                             return Futures.allAsList(Arrays.asList(replyMeterFeature, replyGroupFeatures,
                                     replyTableFeatures, replyPortDescription));
@@ -244,7 +246,8 @@ public class DeviceInitializationUtils {
     }
 
     static void translateAndWriteReply(final MultipartType type, final DeviceContext dContext,
-                                       final InstanceIdentifier<Node> nodeII, final Collection<MultipartReply> result) {
+                                       final InstanceIdentifier<Node> nodeII, final Collection<MultipartReply> result,
+                                       final ConvertorExecutor convertorExecutor) {
         try {
             for (final MultipartReply reply : result) {
                 final MultipartReplyBody body = reply.getMultipartReplyBody();
@@ -263,7 +266,7 @@ public class DeviceInitializationUtils {
                         final MultipartReplyTableFeatures tableFeaturesMP = ((MultipartReplyTableFeaturesCase) body)
                                 .getMultipartReplyTableFeatures();
                         final List<TableFeatures> tableFeatures = NodeStaticReplyTranslatorUtil
-                                .nodeTableFeatureTranslator(tableFeaturesMP);
+                                .nodeTableFeatureTranslator(tableFeaturesMP, dContext.getDeviceInfo().getVersion(), convertorExecutor);
                         for (final TableFeatures tableFeature : tableFeatures) {
                             final Short tableId = tableFeature.getTableId();
                             final KeyedInstanceIdentifier<TableFeatures, TableFeaturesKey> tableFeaturesII =
@@ -394,14 +397,15 @@ public class DeviceInitializationUtils {
 
     static void createSuccessProcessingCallback(final MultipartType type, final DeviceContext deviceContext,
                                                 final InstanceIdentifier<Node> nodeII,
-                                                final ListenableFuture<RpcResult<List<MultipartReply>>> requestContextFuture) {
+                                                final ListenableFuture<RpcResult<List<MultipartReply>>> requestContextFuture,
+                                                final ConvertorExecutor convertorExecutor) {
         Futures.addCallback(requestContextFuture, new FutureCallback<RpcResult<List<MultipartReply>>>() {
             @Override
             public void onSuccess(final RpcResult<List<MultipartReply>> rpcResult) {
                 final List<MultipartReply> result = rpcResult.getResult();
                 if (result != null) {
                     LOG.info("Static node {} info: {} collected", deviceContext.getDeviceInfo().getNodeId(), type);
-                    translateAndWriteReply(type, deviceContext, nodeII, result);
+                    translateAndWriteReply(type, deviceContext, nodeII, result, convertorExecutor);
                 } else {
                     final Iterator<RpcError> rpcErrorIterator = rpcResult.getErrors().iterator();
                     while (rpcErrorIterator.hasNext()) {
index 71d1ddd5e7bfc7c8a0a5d888d468df58a9024195..25860087b9502466f46207623870b570fc4a48b6 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.openflowplugin.impl.util;
 
 import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
 import com.google.common.reflect.TypeToken;
 import java.util.concurrent.atomic.AtomicLong;
 import javax.annotation.CheckForNull;
@@ -45,6 +44,7 @@ import org.opendaylight.openflowplugin.impl.statistics.services.direct.NodeConne
 import org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceImpl;
 import org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceProvider;
 import org.opendaylight.openflowplugin.impl.statistics.services.direct.QueueDirectStatisticsService;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.OpendaylightDirectStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SalEchoService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SalExperimenterMessageService;
@@ -80,21 +80,22 @@ public class MdSalRegistrationUtils {
 
     /**
      * Method registers all OF services for role {@link OfpRole#BECOMEMASTER}
-     *
-     * @param rpcContext    - registration processing is implemented in {@link RpcContext}
-     * @param deviceContext - every service needs {@link DeviceContext} as input parameter
+     *  @param rpcContext    - registration processing is implemented in {@link org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext}
+     * @param deviceContext - every service needs {@link org.opendaylight.openflowplugin.api.openflow.device.DeviceContext} as input parameter
+     * @param convertorExecutor
      */
     public static void registerServices(@CheckForNull final RpcContext rpcContext,
                                         @CheckForNull final DeviceContext deviceContext,
-                                        final ExtensionConverterProvider extensionConverterProvider) {
+                                        final ExtensionConverterProvider extensionConverterProvider,
+                                        final ConvertorExecutor convertorExecutor) {
         Preconditions.checkArgument(rpcContext != null);
         Preconditions.checkArgument(deviceContext != null);
 
         // create service instances
-        final SalFlowServiceImpl salFlowService = new SalFlowServiceImpl(rpcContext, deviceContext);
+        final SalFlowServiceImpl salFlowService = new SalFlowServiceImpl(rpcContext, deviceContext, convertorExecutor);
         final FlowCapableTransactionServiceImpl flowCapableTransactionService = new FlowCapableTransactionServiceImpl(rpcContext, deviceContext);
-        final SalGroupServiceImpl salGroupService = new SalGroupServiceImpl(rpcContext, deviceContext);
-        final SalMeterServiceImpl salMeterService = new SalMeterServiceImpl(rpcContext, deviceContext);
+        final SalGroupServiceImpl salGroupService = new SalGroupServiceImpl(rpcContext, deviceContext, convertorExecutor);
+        final SalMeterServiceImpl salMeterService = new SalMeterServiceImpl(rpcContext, deviceContext, convertorExecutor);
 
         // register routed service instances
         rpcContext.registerRpcServiceImplementation(SalEchoService.class, new SalEchoServiceImpl(rpcContext, deviceContext));
@@ -103,19 +104,19 @@ public class MdSalRegistrationUtils {
         rpcContext.registerRpcServiceImplementation(FlowCapableTransactionService.class, flowCapableTransactionService);
         rpcContext.registerRpcServiceImplementation(SalMeterService.class, salMeterService);
         rpcContext.registerRpcServiceImplementation(SalGroupService.class, salGroupService);
-        rpcContext.registerRpcServiceImplementation(SalTableService.class, new SalTableServiceImpl(rpcContext, deviceContext, deviceContext.getPrimaryConnectionContext().getNodeId()));
-        rpcContext.registerRpcServiceImplementation(SalPortService.class, new SalPortServiceImpl(rpcContext, deviceContext));
-        rpcContext.registerRpcServiceImplementation(PacketProcessingService.class, new PacketProcessingServiceImpl(rpcContext, deviceContext));
+        rpcContext.registerRpcServiceImplementation(SalTableService.class, new SalTableServiceImpl(rpcContext, deviceContext, convertorExecutor));
+        rpcContext.registerRpcServiceImplementation(SalPortService.class, new SalPortServiceImpl(rpcContext, deviceContext, convertorExecutor));
+        rpcContext.registerRpcServiceImplementation(PacketProcessingService.class, new PacketProcessingServiceImpl(rpcContext, deviceContext, convertorExecutor));
         rpcContext.registerRpcServiceImplementation(NodeConfigService.class, new NodeConfigServiceImpl(rpcContext, deviceContext));
-        rpcContext.registerRpcServiceImplementation(OpendaylightFlowStatisticsService.class, OpendaylightFlowStatisticsServiceImpl.createWithOook(rpcContext, deviceContext));
+        rpcContext.registerRpcServiceImplementation(OpendaylightFlowStatisticsService.class, OpendaylightFlowStatisticsServiceImpl.createWithOook(rpcContext, deviceContext, convertorExecutor));
 
         // Direct statistics gathering
         final OpendaylightDirectStatisticsServiceProvider statisticsProvider = new OpendaylightDirectStatisticsServiceProvider();
-        statisticsProvider.register(FlowDirectStatisticsService.class, new FlowDirectStatisticsService(rpcContext, deviceContext));
-        statisticsProvider.register(GroupDirectStatisticsService.class, new GroupDirectStatisticsService(rpcContext, deviceContext));
-        statisticsProvider.register(MeterDirectStatisticsService.class, new MeterDirectStatisticsService(rpcContext, deviceContext));
-        statisticsProvider.register(NodeConnectorDirectStatisticsService.class, new NodeConnectorDirectStatisticsService(rpcContext, deviceContext));
-        statisticsProvider.register(QueueDirectStatisticsService.class, new QueueDirectStatisticsService(rpcContext, deviceContext));
+        statisticsProvider.register(FlowDirectStatisticsService.class, new FlowDirectStatisticsService(rpcContext, deviceContext, convertorExecutor));
+        statisticsProvider.register(GroupDirectStatisticsService.class, new GroupDirectStatisticsService(rpcContext, deviceContext, convertorExecutor));
+        statisticsProvider.register(MeterDirectStatisticsService.class, new MeterDirectStatisticsService(rpcContext, deviceContext, convertorExecutor));
+        statisticsProvider.register(NodeConnectorDirectStatisticsService.class, new NodeConnectorDirectStatisticsService(rpcContext, deviceContext, convertorExecutor));
+        statisticsProvider.register(QueueDirectStatisticsService.class, new QueueDirectStatisticsService(rpcContext, deviceContext, convertorExecutor));
         rpcContext.registerRpcServiceImplementation(OpendaylightDirectStatisticsService.class, new OpendaylightDirectStatisticsServiceImpl(statisticsProvider));
 
         final SalFlatBatchServiceImpl salFlatBatchService = new SalFlatBatchServiceImpl(
@@ -158,13 +159,14 @@ public class MdSalRegistrationUtils {
     /**
      * Support deprecated statistic related services for backward compatibility. The only exception from deprecation is
      * the aggregated flow statistic with match criteria input.
-     *
-     * @param rpcContext
+     *  @param rpcContext
      * @param deviceContext
      * @param notificationPublishService
+     * @param convertorExecutor
      */
     public static void registerStatCompatibilityServices(final RpcContext rpcContext, final DeviceContext deviceContext,
-                                                         final NotificationPublishService notificationPublishService) {
+                                                         final NotificationPublishService notificationPublishService,
+                                                         final ConvertorExecutor convertorExecutor) {
 
         AtomicLong compatibilityXidSeed = new AtomicLong();
         // pickup low statistics service
@@ -173,16 +175,16 @@ public class MdSalRegistrationUtils {
         Preconditions.checkArgument(COMPOSITE_SERVICE_TYPE_TOKEN.isAssignableFrom(flowStatisticsService.getClass()));
         // attach delegate to flow statistics service (to cover all but aggregated stats with match filter input)
         final OpendaylightFlowStatisticsServiceDelegateImpl flowStatisticsDelegate =
-                new OpendaylightFlowStatisticsServiceDelegateImpl(rpcContext, deviceContext, notificationPublishService, new AtomicLong());
+                new OpendaylightFlowStatisticsServiceDelegateImpl(rpcContext, deviceContext, notificationPublishService, new AtomicLong(), convertorExecutor);
         ((Delegator<OpendaylightFlowStatisticsService>) flowStatisticsService).setDelegate(flowStatisticsDelegate);
 
         // register all statistics (deprecated) services
         rpcContext.registerRpcServiceImplementation(OpendaylightFlowTableStatisticsService.class,
                 new OpendaylightFlowTableStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
         rpcContext.registerRpcServiceImplementation(OpendaylightGroupStatisticsService.class,
-                new OpendaylightGroupStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
+                new OpendaylightGroupStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService, convertorExecutor));
         rpcContext.registerRpcServiceImplementation(OpendaylightMeterStatisticsService.class,
-                new OpendaylightMeterStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
+                new OpendaylightMeterStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService, convertorExecutor));
         rpcContext.registerRpcServiceImplementation(OpendaylightQueueStatisticsService.class,
                 new OpendaylightQueueStatisticsServiceImpl(rpcContext, deviceContext, compatibilityXidSeed, notificationPublishService));
         rpcContext.registerRpcServiceImplementation(OpendaylightPortStatisticsService.class,
index dd02168d266ebced87f051cab04444426c14956d..8ec2c59c909a46c604996ee512c1b685b54459fe 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.openflowplugin.impl.translator.PacketReceivedTranslator;
 import org.opendaylight.openflowplugin.impl.translator.PortUpdateTranslator;
 import org.opendaylight.openflowplugin.impl.translator.TranslatorKeyFactory;
 import org.opendaylight.openflowplugin.impl.translator.TranslatorLibraryBuilder;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketIn;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
@@ -35,23 +36,20 @@ public final class TranslatorLibraryUtil {
 
     private static final TranslatorKeyFactory of13TranslatorKeyFactory = new TranslatorKeyFactory(OFConstants.OFP_VERSION_1_3);
     private static final TranslatorKeyFactory of10TranslatorKeyFactory = new TranslatorKeyFactory(OFConstants.OFP_VERSION_1_0);
-    private static final TranslatorLibrary basicTranslatorLibrary;
 
-    static {
-        basicTranslatorLibrary = new TranslatorLibraryBuilder().
-                addTranslator(of13TranslatorKeyFactory.createTranslatorKey(PacketIn.class), new PacketReceivedTranslator()).
+    public static void injectBasicTranslatorLibrary(final TranslatorLibrarian librarian, final ConvertorExecutor convertorExecutor) {
+        final TranslatorLibrary basicTranslatorLibrary = new TranslatorLibraryBuilder().
+                addTranslator(of13TranslatorKeyFactory.createTranslatorKey(PacketIn.class), new PacketReceivedTranslator(convertorExecutor)).
                 addTranslator(of13TranslatorKeyFactory.createTranslatorKey(PortGrouping.class), new PortUpdateTranslator()).
                 addTranslator(of13TranslatorKeyFactory.createTranslatorKey(MultipartReplyAggregateCase.class), new AggregatedFlowStatisticsTranslator()).
-                addTranslator(of13TranslatorKeyFactory.createTranslatorKey(FlowRemoved.class), new FlowRemovedTranslator()).
-                addTranslator(of10TranslatorKeyFactory.createTranslatorKey(PacketIn.class), new PacketReceivedTranslator()).
+                addTranslator(of13TranslatorKeyFactory.createTranslatorKey(FlowRemoved.class), new FlowRemovedTranslator(convertorExecutor)).
+                addTranslator(of10TranslatorKeyFactory.createTranslatorKey(PacketIn.class), new PacketReceivedTranslator(convertorExecutor)).
                 addTranslator(of10TranslatorKeyFactory.createTranslatorKey(PortGrouping.class), new PortUpdateTranslator()).
                 addTranslator(of10TranslatorKeyFactory.createTranslatorKey(MultipartReplyAggregateCase.class), new AggregatedFlowStatisticsTranslator()).
-                addTranslator(of10TranslatorKeyFactory.createTranslatorKey(FlowRemoved.class), new FlowRemovedV10Translator()).
+                addTranslator(of10TranslatorKeyFactory.createTranslatorKey(FlowRemoved.class), new FlowRemovedV10Translator(convertorExecutor)).
 
                 build();
-    }
 
-    public static void setBasicTranslatorLibrary(final TranslatorLibrarian librarian) {
         librarian.setTranslatorLibrary(basicTranslatorLibrary);
     }
 }
index c1ba409b27d33a43966bf16ae1a67d2eb21912bc..99a1cf4ce51b11e4c21dd51b206262c63edb85ae 100644 (file)
@@ -38,6 +38,8 @@ import org.opendaylight.openflowplugin.api.openflow.rpc.RpcManager;
 import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsManager;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency;
 import org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 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;
@@ -92,8 +94,9 @@ public class LifecycleConductorImplTest {
     @Before
     public void setUp() {
         nodeInstanceIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(nodeId));
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
 
-        lifecycleConductor = new LifecycleConductorImpl(messageIntelligenceAgency);
+        lifecycleConductor = new LifecycleConductorImpl(messageIntelligenceAgency, convertorManager);
         lifecycleConductor.setSafelyManager(deviceManager);
         lifecycleConductor.setSafelyManager(statisticsManager);
         lifecycleConductor.setSafelyManager(rpcManager);
index 06faed2cb71d99d6ab3987b755c9e2fdb0192595..5294656ae910260724a271d7b306dac1502dbf17 100644 (file)
@@ -57,6 +57,8 @@ import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceTermin
 import org.opendaylight.openflowplugin.api.openflow.lifecycle.LifecycleConductor;
 import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities;
@@ -148,8 +150,9 @@ public class DeviceManagerImplTest {
 
         when(mockedWriteTransaction.submit()).thenReturn(mockedFuture);
 
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
         final DeviceManagerImpl deviceManager = new DeviceManagerImpl(mockedDataBroker,
-                TEST_VALUE_GLOBAL_NOTIFICATION_QUOTA, false, barrierIntervalNanos, barrierCountLimit, lifecycleConductor, true);
+                TEST_VALUE_GLOBAL_NOTIFICATION_QUOTA, false, barrierIntervalNanos, barrierCountLimit, lifecycleConductor, true, convertorManager);
 
         deviceManager.setDeviceInitializationPhaseHandler(deviceInitPhaseHandler);
         deviceManager.setDeviceTerminationPhaseHandler(deviceTerminationPhaseHandler);
index c86bc598f956a87e1a040ae786a0731a83340727..a085ce1e4cfb591c670a9b60aced993eef958abf 100644 (file)
@@ -44,6 +44,8 @@ import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKe
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
 import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
 import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.MessageIntelligenceAgencyImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
@@ -128,6 +130,7 @@ public class MultipartRequestOnTheFlyCallbackTest {
         when(mockedDeviceState.deviceSynchronized()).thenReturn(true);
         when(mockedDeviceInfo.getNodeId()).thenReturn(mockedNodeId);
         when(mockedDeviceInfo.getDatapathId()).thenReturn(BigInteger.TEN);
+        when(mockedDeviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
 
         when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
         when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo);
@@ -148,9 +151,11 @@ public class MultipartRequestOnTheFlyCallbackTest {
                 //NOOP
             }
         };
+
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
         multipartRequestOnTheFlyCallback = new MultipartRequestOnTheFlyCallback(dummyRequestContext, String.class,
                 mockedDeviceContext.getMessageSpy(),dummyEventIdentifier, mockedDeviceInfo,
-                mockedDeviceContext.getDeviceFlowRegistry(), mockedDeviceContext);
+                mockedDeviceContext.getDeviceFlowRegistry(), mockedDeviceContext, convertorManager);
     }
 
 
index 7647e5c3367aadadd079c52a0dbd7777d2a1211b..8438f009669999a14c185f9a37766842379e8e33 100644 (file)
@@ -15,6 +15,8 @@ import static org.mockito.Mockito.verify;
 import org.junit.Test;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
@@ -45,7 +47,8 @@ public class PacketProcessingServiceImplTest extends ServiceMocking {
 
     @Override
     protected void setup() {
-        packetProcessingService = new PacketProcessingServiceImpl(mockedRequestContextStack, mockedDeviceContext);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        packetProcessingService = new PacketProcessingServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager);
         pathToNodeconnector = KeyedInstanceIdentifier.create(Nodes.class)
                 .child(Node.class, new NodeKey(new NodeId("ofp-ut:123")))
                 .child(NodeConnector.class, new NodeConnectorKey(new NodeConnectorId("ofp-ut:123:1")));
index 070cf5e32bb2f323c149d3284d15af83f0ef577f..89cbef6d7e49435b9e08035672bddc5fb532c03b 100644 (file)
@@ -38,6 +38,8 @@ import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor
 import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKey;
 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 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;
@@ -139,7 +141,8 @@ public class SalFlowServiceImplTest extends TestCase {
         when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
         when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo);
 
-        salFlowService = new SalFlowServiceImpl(mockedRequestContextStack, mockedDeviceContext);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        salFlowService = new SalFlowServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager);
     }
 
     @Test
index fa0d1aae8f3234aea4f60332cf171dc523c7e22a..f0814d8962320ef7bf1e89ecf42033030a9fcebe 100644 (file)
@@ -17,6 +17,8 @@ import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.opendaylight.openflowplugin.api.openflow.registry.group.DeviceGroupRegistry;
 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
@@ -48,7 +50,8 @@ public class SalGroupServiceImplTest extends ServiceMocking {
     public void initialization() {
         super.initialization();
         when(mockedDeviceContext.getDeviceGroupRegistry()).thenReturn(mockedDeviceGroupRegistry);
-        salGroupService = new SalGroupServiceImpl(mockedRequestContextStack, mockedDeviceContext);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        salGroupService = new SalGroupServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager);
     }
 
     @Test
index 0a04fd52bb50eef89235df4a75f5c196bb8e0484..ea20a88647c778e0c1aeb0cdf39a7ba47a050353 100644 (file)
@@ -17,6 +17,8 @@ import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.opendaylight.openflowplugin.api.openflow.registry.meter.DeviceMeterRegistry;
 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 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.MeterKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
@@ -48,7 +50,8 @@ public class SalMeterServiceImplTest extends ServiceMocking {
     public void initialization() {
         super.initialization();
         when(mockedDeviceContext.getDeviceMeterRegistry()).thenReturn(mockedDeviceMeterRegistry);
-        salMeterService = new SalMeterServiceImpl(mockedRequestContextStack, mockedDeviceContext);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        salMeterService = new SalMeterServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager);
     }
 
     @Test
index 04bd3e227bd0be3758a424ebd9bf8f0ea43c8715..a8940cb58ff5bc26e6e86e3cd71e4a913d77d9cf 100644 (file)
@@ -15,6 +15,8 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 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.types.port.rev130925.PortConfig;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures;
@@ -38,7 +40,8 @@ public class SalPortServiceImplTest extends ServiceMocking {
     @Override
     public void initialization() {
         super.initialization();
-        salPortService = new SalPortServiceImpl(mockedRequestContextStack, mockedDeviceContext);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        salPortService = new SalPortServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager);
     }
 
     @Test
index 442e051779a7374673d9d9b0007fca81d6943cb2..3bf020e83e3f22050f70596fc319375d4d37b06f 100644 (file)
@@ -27,6 +27,8 @@ import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 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.MultipartReplyMessageBuilder;
@@ -70,8 +72,9 @@ public class SalTableServiceImplTest extends ServiceMocking {
                 .when(mockedOutboundQueue).commitEntry(
                 Matchers.anyLong(), Matchers.<OfHeader>any(), Matchers.<FutureCallback<OfHeader>>any());
 
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
         salTableService = new SalTableServiceImpl(mockedRequestContextStack, mockedDeviceContext,
-                mockedDeviceContext.getPrimaryConnectionContext().getNodeId());
+                convertorManager);
     }
 
     @Test
index ccca8d077c2aa8f2e39b2ec178943d06b76ef027..3c1cabd8972489b47ac673a37ef8139b883a60f4 100644 (file)
@@ -16,10 +16,13 @@ import com.google.common.collect.Lists;
 import java.math.BigInteger;
 import java.util.Collections;
 import java.util.List;
+import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsUpdate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
@@ -61,7 +64,7 @@ public class SinglePurposeMultipartReplyTranslatorTest {
 
     private static final BigInteger DUMMY_DATAPATH_ID = new BigInteger("21");
     private static final Long DUMMY_XID = 1L;
-    private static final SinglePurposeMultipartReplyTranslator singlePurposeMultipartReplyTranslator = new SinglePurposeMultipartReplyTranslator();
+    private SinglePurposeMultipartReplyTranslator singlePurposeMultipartReplyTranslator;
     private static final BigInteger DUMMY_BYTE_COUNT = new BigInteger("31");
     private static final BigInteger DUMMY_PACKET_COUNT = new BigInteger("41");
     private static final Long DUMMY_FLOW_COUNT = 51L;
@@ -86,6 +89,12 @@ public class SinglePurposeMultipartReplyTranslatorTest {
     private static final GroupType DUMMY_GROUP_TYPE = GroupType.OFPGTALL;
     private static final Long GROUP_ACTION_BITMAP = 0b00000000000000000000000000000000000001111111111111001100000000001L;
 
+    @Before
+    public void setUp() {
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        singlePurposeMultipartReplyTranslator = new SinglePurposeMultipartReplyTranslator(convertorManager);
+    }
+
     @Test
     public void testTranslateFlow() {
         DeviceContext mockedDeviceContext = mock(DeviceContext.class);
index 9f0121779fdc76abee0963cba5abb29a8808ee1e..f89cade140262418ca4ea0faa151d674f0154d94 100644 (file)
@@ -96,6 +96,5 @@ class StatisticsContextImpMockInitiation {
 
         mockConductor.setSafelyManager(mockedDeviceManager);
         when(mockConductor.getDeviceContext(mockedDeviceInfo)).thenReturn(mockedDeviceContext);
-
     }
 }
index 5eeb696049cd0333f98d71fc9ea354291fa64424..445265bb952e6c7680ec9bab3c7f953ba4e96e9a 100644 (file)
@@ -23,6 +23,8 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 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.yangtools.yang.common.RpcResult;
@@ -61,8 +63,8 @@ public class StatisticsContextImplParamTest extends StatisticsContextImpMockInit
     @Test
     public void gatherDynamicDataTest() {
 
-
-        final StatisticsContextImpl statisticsContext = new StatisticsContextImpl(mockedDeviceInfo, false, mockConductor);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        final StatisticsContextImpl statisticsContext = new StatisticsContextImpl(mockedDeviceInfo, false, mockConductor, convertorManager);
 
         final ListenableFuture<RpcResult<List<MultipartReply>>> rpcResult = immediateFuture(RpcResultBuilder.success(Collections.<MultipartReply>emptyList()).build());
         when(mockedStatisticsGatheringService.getStatisticsOfType(any(EventIdentifier.class), any(MultipartType
index 30e51bcccf3acea6aa71821c2b64d266cd794fde..6c7ef1a7000681ef6b2c56b8838c056fe534c88c 100644 (file)
@@ -28,6 +28,8 @@ import org.mockito.runners.MockitoJUnitRunner;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 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.yangtools.yang.common.RpcResult;
@@ -42,16 +44,18 @@ public class StatisticsContextImplTest extends StatisticsContextImpMockInitiatio
 
     private static final Long TEST_XID = 55L;
     private StatisticsContextImpl statisticsContext;
+    private ConvertorManager convertorManager;
 
     @Before
     public void setUp() throws Exception {
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
         when(mockedDeviceContext.reserveXidForDeviceMessage()).thenReturn(TEST_XID);
         when(mockConductor.getDeviceContext(mockedDeviceInfo)).thenReturn(mockedDeviceContext);
         initStatisticsContext();
     }
 
     private void initStatisticsContext() {
-        statisticsContext = new StatisticsContextImpl(mockedDeviceInfo, false, mockConductor);
+        statisticsContext = new StatisticsContextImpl(mockedDeviceInfo, false, mockConductor, convertorManager);
         statisticsContext.setStatisticsGatheringService(mockedStatisticsGatheringService);
         statisticsContext.setStatisticsGatheringOnTheFlyService(mockedStatisticsOnFlyGatheringService);
     }
@@ -69,7 +73,7 @@ public class StatisticsContextImplTest extends StatisticsContextImpMockInitiatio
      */
     @Test
     public void testClose() throws Exception {
-        final StatisticsContextImpl statisticsContext = new StatisticsContextImpl(mockedDeviceInfo, false, mockConductor);
+        final StatisticsContextImpl statisticsContext = new StatisticsContextImpl(mockedDeviceInfo, false, mockConductor, convertorManager);
         final RequestContext<Object> requestContext = statisticsContext.createRequestContext();
         statisticsContext.close();
         try {
index 3e3085d254df8f7623f037a2dd0af6dcc5ea23f5..57a890ed4cd3ed0d1ef16eda4f3a641d2cd89453 100644 (file)
@@ -22,7 +22,6 @@ import java.util.List;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -48,6 +47,8 @@ import org.opendaylight.openflowplugin.api.openflow.registry.meter.DeviceMeterRe
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.StatisticsGatherer;
 import org.opendaylight.openflowplugin.impl.registry.flow.FlowRegistryKeyFactory;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
@@ -164,12 +165,16 @@ public class StatisticsGatheringUtilsTest {
     @Mock
     private TxFacade txFacade;
 
+    private SinglePurposeMultipartReplyTranslator singlePurposeMultipartReplyTranslator;
+
     public StatisticsGatheringUtilsTest() {
         OpenflowPortsUtil.init();
     }
 
     @Before
     public void setUp() throws Exception {
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        singlePurposeMultipartReplyTranslator = new SinglePurposeMultipartReplyTranslator(convertorManager);
         when(deviceContext.getDeviceState()).thenReturn(deviceState);
         when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
         when(deviceContext.getDeviceFlowRegistry()).thenReturn(deviceFlowRegistry);
@@ -189,11 +194,6 @@ public class StatisticsGatheringUtilsTest {
         when(deviceInfo.getNodeId()).thenReturn(DUMMY_NODE_ID);
     }
 
-    @After
-    public void tearDown() throws Exception {
-
-    }
-
     @Test
     public void testWriteFlowStatistics() throws Exception {
         final ArgumentCaptor<LogicalDatastoreType> dataStoreType = ArgumentCaptor.forClass(LogicalDatastoreType.class);
@@ -496,7 +496,8 @@ public class StatisticsGatheringUtilsTest {
                 type,
                 txFacade,
                 deviceContext,
-                false);
+                false,
+                singlePurposeMultipartReplyTranslator);
         Assert.assertTrue(gatherStatisticsResult.get(1, TimeUnit.SECONDS).booleanValue());
         verify(txFacade).submitTransaction();
     }
index c36821897dfb5cef6a87af57e82edaf55be7c3f6..6c4229e10fa6cfd280560c3a654eb24f2adf7acc 100644 (file)
@@ -58,6 +58,8 @@ import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleLi
 import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
 import org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 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;
@@ -182,7 +184,8 @@ public class StatisticsManagerImplTest {
                 Matchers.eq(StatisticsManagerControlService.class),
                 Matchers.<StatisticsManagerControlService>any())).thenReturn(serviceControlRegistration);
 
-        statisticsManager = new StatisticsManagerImpl(rpcProviderRegistry, false, conductor);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        statisticsManager = new StatisticsManagerImpl(rpcProviderRegistry, false, conductor, convertorManager);
         statisticsManager.setDeviceInitializationPhaseHandler(deviceInitializationPhaseHandler);
         when(conductor.getDeviceContext(deviceInfo)).thenReturn(mockedDeviceContext);
     }
index bd25110f4a528f2efaa7e5cf161251c1b6130ab7..3a8f42c4f91bfdeb58d37ae9373a86f91ce470da 100644 (file)
@@ -104,7 +104,6 @@ public abstract class AbstractStatsServiceTest {
         Mockito.when(getFeaturesOutput.getDatapathId()).thenReturn(BigInteger.valueOf(123L));
         Mockito.when(getFeaturesOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
 
-
         setUp();
     }
 
index 49a16e38c00cd4a4a89a535d639023453ca40e86..009ff0de2f938de3391f35978fa8e8052dc2af8c 100644 (file)
@@ -14,6 +14,8 @@ import org.mockito.ArgumentCaptor;
 import org.mockito.Captor;
 import org.mockito.Mockito;
 import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
@@ -36,7 +38,8 @@ public class OpendaylightFlowStatisticsServiceImpl1Test extends AbstractStatsSer
     private OpendaylightFlowStatisticsServiceImpl flowStatisticsService;
 
     public void setUp() {
-        flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
 
         rqContext = new AbstractRequestContext<Object>(42L) {
             @Override
index 8c3d71dbb6debce9ebdcba942fc22549578c7f6b..3f093b0387335fcdb4a59c35baeb2e5393538973 100644 (file)
@@ -26,6 +26,8 @@ import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
 import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
 import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatistics;
@@ -53,7 +55,8 @@ public class OpendaylightFlowStatisticsServiceImpl2Test extends AbstractStatsSer
 
 
     public void setUp() {
-        flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
 
         rqContextMp = new AbstractRequestContext<List<MultipartReply>>(42L) {
             @Override
index 329c670886197ef70f61c5d55ae8da33f6a28ad7..b565c379a61438d48cfa4ae1032af2e572dc1d16 100644 (file)
@@ -11,6 +11,8 @@ package org.opendaylight.openflowplugin.impl.statistics.services;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.Mockito;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
@@ -33,7 +35,8 @@ public class OpendaylightFlowStatisticsServiceImpl3Test extends AbstractStatsSer
     private OpendaylightFlowStatisticsServiceImpl flowStatisticsService;
 
     public void setUp() {
-        flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
         flowStatisticsService.setDelegate(flowStatisticsDelegate);
     }
 
index 84e5b4e2d37fadafb6cb25d8c9e1043f8de693a1..9357d2cd787e5ad43d1e6cead5f1e5c4688b2c68 100644 (file)
@@ -21,6 +21,8 @@ import org.mockito.Captor;
 import org.mockito.Matchers;
 import org.mockito.Mockito;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInputBuilder;
@@ -65,8 +67,9 @@ public class OpendaylightGroupStatisticsServiceImplTest extends AbstractSingleSt
     private OpendaylightGroupStatisticsServiceImpl groupStatisticsService;
 
     public void setUp() {
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
         groupStatisticsService = new OpendaylightGroupStatisticsServiceImpl(rqContextStack, deviceContext,
-                new AtomicLong(), notificationPublishService);
+                new AtomicLong(), notificationPublishService, convertorManager);
 
         Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider)
                 .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
index 0952a01dc9543ea21de3f59e6d97cc74e41e5f9c..04e5c85a911b22f17db2396c8de75ec3cdba565e 100644 (file)
@@ -21,6 +21,8 @@ import org.mockito.Captor;
 import org.mockito.Matchers;
 import org.mockito.Mockito;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInputBuilder;
@@ -64,8 +66,9 @@ public class OpendaylightMeterStatisticsServiceImplTest extends AbstractSingleSt
     private OpendaylightMeterStatisticsServiceImpl meterStatisticsService;
 
     public void setUp() {
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
         meterStatisticsService = new OpendaylightMeterStatisticsServiceImpl(rqContextStack, deviceContext,
-                new AtomicLong(), notificationPublishService);
+                new AtomicLong(), notificationPublishService, convertorManager);
 
         Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider)
                 .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
index 251eb10fb1b25f2790f32c020a8312ac6f3c4dbc..86fcdaa9a195f27ee14f2bc7289894a3667ff33f 100644 (file)
@@ -24,6 +24,8 @@ import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
 import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
 import org.opendaylight.openflowplugin.impl.statistics.services.AbstractSingleStatsServiceTest;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 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.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
@@ -76,8 +78,9 @@ public class OpendaylightFlowStatisticsServiceDelegateImplTest extends AbstractS
 
     @Override
     public void setUp() {
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
         flowStatisticsServiceDelegate = new OpendaylightFlowStatisticsServiceDelegateImpl(
-                rqContextStack, deviceContext, notificationPublishService, new AtomicLong(21));
+                rqContextStack, deviceContext, notificationPublishService, new AtomicLong(21), convertorManager);
 
         Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider)
                 .commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
index eb17d48ae775499080e9c194199cc91b54c3bacd..dd292d112d65d46665ae90d4d7ad4049c3335234 100644 (file)
@@ -14,6 +14,8 @@ import org.mockito.Mockito;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
 import org.opendaylight.openflowplugin.impl.services.ServiceMocking;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
@@ -29,7 +31,8 @@ public class StatisticsGatheringOnTheFlyServiceTest extends ServiceMocking {
 
     @Override
     protected void setup() {
-        statisticsGatheringService = new StatisticsGatheringOnTheFlyService(mockedRequestContextStack, mockedDeviceContext);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        statisticsGatheringService = new StatisticsGatheringOnTheFlyService(mockedRequestContextStack, mockedDeviceContext, convertorManager);
         Mockito.doReturn(NODE_ID).when(mockedPrimConnectionContext).getNodeId();
         Mockito.when(mockedDeviceInfo.getNodeId()).thenReturn(NODE_ID);
         Mockito.when(mockedDeviceContext.getDeviceInfo().getNodeId()).thenReturn(NODE_ID);
index 024d08762f64275293470e516b35ab30b6dcc555..bedc24e4be18badd9bfc8e8b7bd077044537fcfc 100644 (file)
@@ -28,6 +28,8 @@ import org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
@@ -73,6 +75,7 @@ public abstract class AbstractDirectStatisticsServiceTest {
 
     protected NodeConnectorId nodeConnectorId;
     protected KeyedInstanceIdentifier<Node, NodeKey> nodeInstanceIdentifier;
+    protected ConvertorManager convertorManager;
 
     protected static NodeRef createNodeRef(String nodeIdValue) {
         InstanceIdentifier<Node> nodePath = InstanceIdentifier.create(Nodes.class)
@@ -92,6 +95,8 @@ public abstract class AbstractDirectStatisticsServiceTest {
                 .create(Nodes.class)
                 .child(Node.class, new NodeKey(new NodeId(NODE_ID)));
 
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
+
         when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
         when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
         when(deviceContext.getMultiMsgCollector(any())).thenReturn(multiMsgCollector);
index 0d234bb31e00e4614e287f5ac17aacc9eed5af61..9dd7d6aaf954745c388a1e2f5a855a6988f8d044 100644 (file)
@@ -43,7 +43,7 @@ public class FlowDirectStatisticsServiceTest extends AbstractDirectStatisticsSer
 
     @Override
     public void setUp() throws Exception {
-        service = new FlowDirectStatisticsService(requestContextStack, deviceContext);
+        service = new FlowDirectStatisticsService(requestContextStack, deviceContext, convertorManager);
         final DeviceFlowRegistry registry = mock(DeviceFlowRegistry.class);
         when(registry.storeIfNecessary(any())).thenReturn(new FlowId("1"));
         when(deviceContext.getDeviceFlowRegistry()).thenReturn(registry);
index 6b8af6873ba32dc4b594ee3d4ef6e94eba20526d..ab8cd6072bbb640423146b801ee2040d4fa3d17d 100644 (file)
@@ -38,7 +38,7 @@ public class GroupDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
 
     @Override
     public void setUp() throws Exception {
-        service = new GroupDirectStatisticsService(requestContextStack, deviceContext);
+        service = new GroupDirectStatisticsService(requestContextStack, deviceContext, convertorManager);
     }
 
     @Override
index c3da98efdc81dd96789fc610b6007d99cf107fe7..ed96db005f649d0d6cf5386f1a27eca59691c761 100644 (file)
@@ -38,7 +38,7 @@ public class MeterDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
 
     @Override
     public void setUp() throws Exception {
-        service = new MeterDirectStatisticsService(requestContextStack, deviceContext);
+        service = new MeterDirectStatisticsService(requestContextStack, deviceContext, convertorManager);
     }
 
     @Override
index d95595e08205e6c4fb109fbb57ae782ab3275dad..aaaeb7548d6e1857bdf42a14bc1d6030082e7e19 100644 (file)
@@ -35,7 +35,7 @@ public class NodeConnectorDirectStatisticsServiceTest extends AbstractDirectStat
 
     @Override
     public void setUp() throws Exception {
-        service = new NodeConnectorDirectStatisticsService(requestContextStack, deviceContext);
+        service = new NodeConnectorDirectStatisticsService(requestContextStack, deviceContext, convertorManager);
     }
 
     @Override
index c8ae34a06bab366bdbb20e0e0735975d3f60012e..388f73630353fc6b20248da554fc8081364a5a2a 100644 (file)
@@ -38,7 +38,7 @@ public class QueueDirectStatisticsServiceTest extends AbstractDirectStatisticsSe
 
     @Override
     public void setUp() throws Exception {
-        service = new QueueDirectStatisticsService(requestContextStack, deviceContext);
+        service = new QueueDirectStatisticsService(requestContextStack, deviceContext, convertorManager);
     }
 
     @Override
index d3e95982193122398c65b6cd178982502ff927a1..b12cdb23ca9ee239d1ee79d214b851364d658e16 100644 (file)
@@ -21,6 +21,8 @@ import org.mockito.runners.MockitoJUnitRunner;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
@@ -68,8 +70,9 @@ public class FlowRemovedTranslatorTest {
         nodeId = InstanceIdentifier.create(Nodes.class)
                 .child(Node.class, new NodeKey(new NodeId("dummyNodeId")));
 
-        translator = new FlowRemovedTranslator();
-        translatorV10 = new FlowRemovedV10Translator();
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        translator = new FlowRemovedTranslator(convertorManager);
+        translatorV10 = new FlowRemovedV10Translator(convertorManager);
 
         when(deviceContext.getDeviceState()).thenReturn(deviceState);
         when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeId);
index 632309ea7cd52ea43b1d6d62cbdaf1df1edc8d47..6a4ef2ebc23f8f8e48a5347aa7d5b832bdc21c51 100644 (file)
@@ -24,6 +24,8 @@ import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
@@ -76,6 +78,8 @@ public class PacketReceivedTranslatorTest {
     @Mock
     PhyPort phyPort;
 
+    ConvertorManager convertorManager;
+
     static final Long PORT_NO = 5l;
     static final Long PORT_NO_DS = 6l;
     static final String DATA = "Test_Data";
@@ -88,6 +92,7 @@ public class PacketReceivedTranslatorTest {
     @Before
     public void setUp() throws Exception {
         final List<PhyPort> phyPorts = Arrays.asList(phyPort);
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
 
         Mockito.when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
         Mockito.when(connectionContext.getFeatures()).thenReturn(featuresReply);
@@ -105,7 +110,7 @@ public class PacketReceivedTranslatorTest {
         final KeyedInstanceIdentifier<Node, NodeKey> nodePath = KeyedInstanceIdentifier
                 .create(Nodes.class)
                 .child(Node.class, new NodeKey(new NodeId("openflow:10")));
-        final PacketReceivedTranslator packetReceivedTranslator = new PacketReceivedTranslator();
+        final PacketReceivedTranslator packetReceivedTranslator = new PacketReceivedTranslator(convertorManager);
         final PacketInMessage packetInMessage = createPacketInMessage(DATA.getBytes(), PORT_NO);
         Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodePath);
 
@@ -150,7 +155,8 @@ public class PacketReceivedTranslatorTest {
                 .setVersion(OFConstants.OFP_VERSION_1_3);
         BigInteger dpid = BigInteger.TEN;
 
-        final Match packetInMatch = PacketReceivedTranslator.getPacketInMatch(inputBld.build(), dpid);
+        final PacketReceivedTranslator packetReceivedTranslator = new PacketReceivedTranslator(convertorManager);
+        final Match packetInMatch = packetReceivedTranslator.getPacketInMatch(inputBld.build(), dpid);
 
         Assert.assertNotNull(packetInMatch.getInPort());
         Assert.assertEquals("openflow:10:" + PORT_NUM_VALUE, packetInMatch.getInPort().getValue());
index 71da6bd8c1388382fe4e228959e041d9e50fbd3a..08476e5debb82bed8978a8e94b6f2997fc7c54fc 100644 (file)
@@ -54,6 +54,8 @@ import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceInitia
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
 import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
 import org.opendaylight.openflowplugin.impl.device.DeviceContextImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
@@ -136,9 +138,12 @@ public class DeviceInitializationUtilsTest {
     @Mock
     private DeviceInfo deviceInfo;
 
+    private ConvertorManager convertorManager;
+
     @Before
     public void setUp() throws Exception {
         OpenflowPortsUtil.init();
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
 
         when(mockConnectionContext.getNodeId()).thenReturn(new NodeId(DUMMY_NODE_ID));
         when(mockConnectionContext.getFeatures()).thenReturn(mockFeatures);
@@ -171,7 +176,7 @@ public class DeviceInitializationUtilsTest {
         final ConnectionContext connectionContext = buildMockConnectionContext(OFConstants.OFP_VERSION_1_0);
         when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
 
-        DeviceInitializationUtils.initializeNodeInformation(mockedDeviceContext, true);
+        DeviceInitializationUtils.initializeNodeInformation(mockedDeviceContext, true, convertorManager);
 
         verify(mockFeatures, atLeastOnce()).getPhyPort();
         verify(tLibrary, atLeastOnce()).lookupTranslator(any(TranslatorKey.class));
@@ -208,13 +213,14 @@ public class DeviceInitializationUtilsTest {
 
         final Collection<MultipartReply> multipartReplyMessages = prepareDataforTypeDesc(mockedDeviceContext);
 
-        DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
+        DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages, convertorManager);
         verify(mockedDeviceContext)
                 .writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), eq(DUMMY_NODE_II.augmentation(FlowCapableNode.class)), any(FlowCapableNode.class));
     }
 
     @Test
     public void translateAndWriteReplyTypeTableFeatures() throws Exception {
+        when(mockedDeviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
         TableFeaturesBuilder tableFeature = new TableFeaturesBuilder();
         tableFeature.setTableId(DUMMY_TABLE_ID);
         final List<TableFeatures> tableFeatures = new ArrayList<>();
@@ -226,7 +232,7 @@ public class DeviceInitializationUtilsTest {
 
         final MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyTableFeaturesCaseBuilder.build()).build();
         final Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
-        DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPTABLEFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
+        DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPTABLEFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages, convertorManager);
         verify(mockedDeviceContext)
                 .writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL),
                         eq(DUMMY_NODE_II.augmentation(FlowCapableNode.class).child(Table.class, new TableKey(DUMMY_TABLE_ID))), any(Table.class));
@@ -248,7 +254,7 @@ public class DeviceInitializationUtilsTest {
 
         final MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyMeterFeaturesCaseBuilder.build()).build();
         final Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
-        DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPMETERFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
+        DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPMETERFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages, convertorManager);
         verify(mockedDeviceContext)
                 .writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), eq(DUMMY_NODE_II.augmentation(NodeMeterFeatures.class)), any(NodeMeterFeatures.class));
         verify(mockedDeviceState).setMeterAvailable(eq(true));
@@ -270,7 +276,7 @@ public class DeviceInitializationUtilsTest {
         final MultipartReplyMessage multipartReplyMessage = new MultipartReplyMessageBuilder().setMultipartReplyBody(multipartReplyGroupFeaturesCaseBuilder.build()).build();
         final Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
 
-        DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPGROUPFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
+        DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPGROUPFEATURES, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages, convertorManager);
         verify(mockedDeviceContext)
                 .writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), eq(DUMMY_NODE_II.augmentation(NodeGroupFeatures.class)), any(NodeGroupFeatures.class));
     }
@@ -304,7 +310,7 @@ public class DeviceInitializationUtilsTest {
         final Set<MultipartReply> multipartReplyMessages = Collections.<MultipartReply>singleton(multipartReplyMessage);
 
         OpenflowPortsUtil.init();
-        DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPPORTDESC, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages);
+        DeviceInitializationUtils.translateAndWriteReply(MultipartType.OFPMPPORTDESC, mockedDeviceContext, DUMMY_NODE_II, multipartReplyMessages, convertorManager);
         verify(mockedDeviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL),
                 Matchers.<InstanceIdentifier<NodeConnector>> any(), any(NodeConnector.class));
     }
@@ -320,12 +326,12 @@ public class DeviceInitializationUtilsTest {
         final RpcResult<List<MultipartReply>> result = RpcResultBuilder.<List<MultipartReply>>success(multipartReplies).build();
         ListenableFuture<RpcResult<List<MultipartReply>>> mockedRequestContextFuture = Futures.immediateFuture(result);
 
-        DeviceInitializationUtils.createSuccessProcessingCallback(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, mockedRequestContextFuture);
+        DeviceInitializationUtils.createSuccessProcessingCallback(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, mockedRequestContextFuture, convertorManager);
         verify(mockedDeviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), eq(DUMMY_NODE_II.augmentation(FlowCapableNode.class)), any(FlowCapableNode.class));
 
         final RpcResult<List<MultipartReply>> rpcResult = RpcResultBuilder.<List<MultipartReply>>failed().withError(RpcError.ErrorType.PROTOCOL, "dummy error").build();
         mockedRequestContextFuture = Futures.immediateFuture(rpcResult);
-        DeviceInitializationUtils.createSuccessProcessingCallback(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, mockedRequestContextFuture);
+        DeviceInitializationUtils.createSuccessProcessingCallback(MultipartType.OFPMPDESC, mockedDeviceContext, DUMMY_NODE_II, mockedRequestContextFuture, convertorManager);
         verify(mockedDeviceContext).writeToTransaction(eq(LogicalDatastoreType.OPERATIONAL), eq(DUMMY_NODE_II.augmentation(FlowCapableNode.class)), any(FlowCapableNode.class));
     }
 
index 4a5d9402276a639e8f5ed6a03d9c50f6febf7b5a..33f544b022d63d34dd63beca6ef00dda0ea8bee3 100644 (file)
@@ -24,8 +24,9 @@ import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
 import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
 public class MdSalRegistrationUtilsTest {
@@ -58,7 +59,8 @@ public class MdSalRegistrationUtilsTest {
         when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedConnectionContext);
 
         final ExtensionConverterProvider extensionConverterProvider = mock(ExtensionConverterProvider.class);
-        MdSalRegistrationUtils.registerServices(mockedRpcContext, mockedDeviceContext, extensionConverterProvider);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        MdSalRegistrationUtils.registerServices(mockedRpcContext, mockedDeviceContext, extensionConverterProvider, convertorManager);
         verify(mockedRpcContext, times(NUMBER_OF_RPC_SERVICE_REGISTRATION)).registerRpcServiceImplementation(
                 Matchers.<Class<RpcService>> any(), any(RpcService.class));
     }
index 2a4520782b400c231eb72330725cfccaf43d1f0c..862f01a9a43fd8b2bbdcce03e2e3d1feca16a6e5 100644 (file)
@@ -18,6 +18,8 @@ import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
 import org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary;
 import org.opendaylight.openflowplugin.api.openflow.translator.TranslatorLibrarian;
 import org.opendaylight.openflowplugin.impl.translator.TranslatorKeyFactory;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketIn;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase;
@@ -48,7 +50,8 @@ public class TranslatorLibratyUtilTest {
 
     @Test
     public void setBasicTranslatorLibraryTest() {
-        TranslatorLibraryUtil.setBasicTranslatorLibrary(translatorLibrarian);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        TranslatorLibraryUtil.injectBasicTranslatorLibrary(translatorLibrarian, convertorManager);
         TranslatorLibrary translatorLibrary = translatorLibrarian.oook();
 
         TranslatorKeyFactory of13TranslatorKeyFactory = new TranslatorKeyFactory(OFP_VERSION_1_3);
index da6901c395735c6a72feaf9ffc96d24ed7ef97a8..d13362ec9b53d00d6ab71798f93f236298dc2a1a 100644 (file)
@@ -37,6 +37,7 @@ import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
 import org.opendaylight.openflowplugin.api.openflow.md.queue.PopListener;
 import org.opendaylight.openflowplugin.api.openflow.statistics.MessageSpy;
 import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.translator.ErrorTranslator;
 import org.opendaylight.openflowplugin.openflow.md.core.translator.ErrorV10Translator;
@@ -106,6 +107,7 @@ import org.slf4j.LoggerFactory;
 public class MDController implements IMDController, AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(MDController.class);
+    private final ConvertorExecutor convertorExecutor;
 
     private Collection<SwitchConnectionProvider> switchConnectionProviders;
 
@@ -120,6 +122,10 @@ public class MDController implements IMDController, AutoCloseable {
 
     private ExtensionConverterProvider extensionConverterProvider;
 
+    public MDController(ConvertorExecutor convertorExecutor) {
+        this.convertorExecutor = convertorExecutor;
+    }
+
     /**
      * @return translator mapping
      */
@@ -140,19 +146,19 @@ public class MDController implements IMDController, AutoCloseable {
         //TODO: move registration to factory
         addMessageTranslator(ErrorMessage.class, OF10, new ErrorV10Translator());
         addMessageTranslator(ErrorMessage.class, OF13, new ErrorTranslator());
-        addMessageTranslator(FlowRemovedMessage.class, OF10, new FlowRemovedTranslator());
-        addMessageTranslator(FlowRemovedMessage.class, OF13, new FlowRemovedTranslator());
+        addMessageTranslator(FlowRemovedMessage.class, OF10, new FlowRemovedTranslator(convertorExecutor));
+        addMessageTranslator(FlowRemovedMessage.class, OF13, new FlowRemovedTranslator(convertorExecutor));
         addMessageTranslator(PacketInMessage.class,OF10, new PacketInV10Translator());
-        addMessageTranslator(PacketInMessage.class,OF13, new PacketInTranslator());
+        addMessageTranslator(PacketInMessage.class,OF13, new PacketInTranslator(convertorExecutor));
         addMessageTranslator(PortStatusMessage.class,OF10, new PortStatusMessageToNodeConnectorUpdatedTranslator());
         addMessageTranslator(PortStatusMessage.class,OF13, new PortStatusMessageToNodeConnectorUpdatedTranslator());
         addMessageTranslator(MultipartReplyMessage.class,OF13,new MultiPartReplyPortToNodeConnectorUpdatedTranslator());
         addMessageTranslator(MultipartReplyMessage.class,OF10, new MultiPartMessageDescToNodeUpdatedTranslator());
         addMessageTranslator(MultipartReplyMessage.class,OF13, new MultiPartMessageDescToNodeUpdatedTranslator());
         addMessageTranslator(ExperimenterMessage.class, OF10, new ExperimenterTranslator());
-        addMessageTranslator(MultipartReplyMessage.class,OF10, new MultipartReplyTranslator());
-        addMessageTranslator(MultipartReplyMessage.class,OF13, new MultipartReplyTranslator());
-        addMessageTranslator(MultipartReplyMessage.class,OF13,new MultipartReplyTableFeaturesToTableUpdatedTranslator());
+        addMessageTranslator(MultipartReplyMessage.class,OF10, new MultipartReplyTranslator(convertorExecutor));
+        addMessageTranslator(MultipartReplyMessage.class,OF13, new MultipartReplyTranslator(convertorExecutor));
+        addMessageTranslator(MultipartReplyMessage.class,OF13,new MultipartReplyTableFeaturesToTableUpdatedTranslator(convertorExecutor));
         addMessageTranslator(GetFeaturesOutput.class,OF10, new FeaturesV10ToNodeConnectorUpdatedTranslator());
         addMessageTranslator(NotificationQueueWrapper.class, OF10, new NotificationPlainTranslator());
         addMessageTranslator(NotificationQueueWrapper.class, OF13, new NotificationPlainTranslator());
index 40c845c7e0dc0fd16af70c21a9c090ca371da7d8..74f503cb626fbf045e55614969a9d31454136d98 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.IMessageDispatchService;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PacketOutConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.PacketOutConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
@@ -111,6 +111,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
     private final NodeId nodeId;
     private final IMessageDispatchService messageService;
     private short version = 0;
+    private final ConvertorExecutor convertorExecutor;
     private OFRpcTaskContext rpcTaskContext;
 
     // TODO:read timeout from configSubsystem
@@ -118,11 +119,12 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
     protected TimeUnit maxTimeoutUnit = TimeUnit.MILLISECONDS;
 
     protected ModelDrivenSwitchImpl(final NodeId nodeId, final InstanceIdentifier<Node> identifier,
-                                    final SessionContext sessionContext) {
+                                    final SessionContext sessionContext, final ConvertorExecutor convertorExecutor) {
         super(identifier, sessionContext);
         this.nodeId = nodeId;
         messageService = sessionContext.getMessageDispatchService();
         version = sessionContext.getPrimaryConductor().getVersion();
+        this.convertorExecutor = convertorExecutor;
         final NotificationProviderService rpcNotificationProviderService = OFSessionUtil.getSessionManager().getNotificationProviderService();
 
         rpcTaskContext = new OFRpcTaskContext();
@@ -143,7 +145,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         SwitchConnectionDistinguisher cookie = null;
 
         OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> task =
-                OFRpcTaskFactory.createAddFlowTask(rpcTaskContext, input, cookie);
+                OFRpcTaskFactory.createAddFlowTask(rpcTaskContext, input, cookie, convertorExecutor);
         ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit();
 
         return Futures.transform(result, OFRpcFutureResultTransformFactory.createForAddFlowOutput());
@@ -158,7 +160,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         SwitchConnectionDistinguisher cookie = null;
 
         OFRpcTask<AddGroupInput, RpcResult<UpdateGroupOutput>> task =
-                OFRpcTaskFactory.createAddGroupTask(rpcTaskContext, input, cookie);
+                OFRpcTaskFactory.createAddGroupTask(rpcTaskContext, input, cookie, convertorExecutor);
         ListenableFuture<RpcResult<UpdateGroupOutput>> result = task.submit();
 
         return Futures.transform(result, OFRpcFutureResultTransformFactory.createForAddGroupOutput());
@@ -172,7 +174,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         SwitchConnectionDistinguisher cookie = null;
 
         OFRpcTask<AddMeterInput, RpcResult<UpdateMeterOutput>> task =
-                OFRpcTaskFactory.createAddMeterTask(rpcTaskContext, input, cookie);
+                OFRpcTaskFactory.createAddMeterTask(rpcTaskContext, input, cookie, convertorExecutor);
         ListenableFuture<RpcResult<UpdateMeterOutput>> result = task.submit();
 
         return Futures.transform(result, OFRpcFutureResultTransformFactory.createForAddMeterOutput());
@@ -185,7 +187,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         // use primary connection
         SwitchConnectionDistinguisher cookie = null;
         OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>> task =
-                OFRpcTaskFactory.createRemoveFlowTask(rpcTaskContext, input, cookie);
+                OFRpcTaskFactory.createRemoveFlowTask(rpcTaskContext, input, cookie, convertorExecutor);
         ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit();
 
         return Futures.transform(result, OFRpcFutureResultTransformFactory.createForRemoveFlowOutput());
@@ -197,7 +199,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
 
         SwitchConnectionDistinguisher cookie = null;
         OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>> task =
-                OFRpcTaskFactory.createRemoveGroupTask(rpcTaskContext, input, cookie);
+                OFRpcTaskFactory.createRemoveGroupTask(rpcTaskContext, input, cookie, convertorExecutor);
         ListenableFuture<RpcResult<UpdateGroupOutput>> result = task.submit();
 
         return Futures.transform(result, OFRpcFutureResultTransformFactory.createForRemoveGroupOutput());
@@ -209,7 +211,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
 
         SwitchConnectionDistinguisher cookie = null;
         OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>> task =
-                OFRpcTaskFactory.createRemoveMeterTask(rpcTaskContext, input, cookie);
+                OFRpcTaskFactory.createRemoveMeterTask(rpcTaskContext, input, cookie, convertorExecutor);
         ListenableFuture<RpcResult<UpdateMeterOutput>> result = task.submit();
 
         return Futures.transform(result, OFRpcFutureResultTransformFactory.createForRemoveMeterOutput());
@@ -223,7 +225,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         data.setDatapathId(sessionContext.getFeatures().getDatapathId());
         data.setXid(sessionContext.getNextXid());
 
-        final java.util.Optional<PacketOutInput> message = ConvertorManager.getInstance().convert(input, data);
+        final java.util.Optional<PacketOutInput> message = convertorExecutor.convert(input, data);
 
         SwitchConnectionDistinguisher cookie = null;
         ConnectionCookie connectionCookie = input.getConnectionCookie();
@@ -244,7 +246,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         SwitchConnectionDistinguisher cookie = null;
         final ReadWriteTransaction rwTx = OFSessionUtil.getSessionManager().getDataBroker().newReadWriteTransaction();
         OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> task =
-                OFRpcTaskFactory.createUpdateFlowTask(rpcTaskContext, input, cookie, rwTx);
+                OFRpcTaskFactory.createUpdateFlowTask(rpcTaskContext, input, cookie, rwTx, convertorExecutor);
         ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit();
 
         return result;
@@ -258,7 +260,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         SwitchConnectionDistinguisher cookie = null;
 
         OFRpcTask<UpdateGroupInput, RpcResult<UpdateGroupOutput>> task =
-                OFRpcTaskFactory.createUpdateGroupTask(rpcTaskContext, input, cookie);
+                OFRpcTaskFactory.createUpdateGroupTask(rpcTaskContext, input, cookie, convertorExecutor);
         ListenableFuture<RpcResult<UpdateGroupOutput>> result = task.submit();
 
         return result;
@@ -272,7 +274,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         SwitchConnectionDistinguisher cookie = null;
 
         OFRpcTask<UpdateMeterInput, RpcResult<UpdateMeterOutput>> task =
-                OFRpcTaskFactory.createUpdateMeterTask(rpcTaskContext, input, cookie);
+                OFRpcTaskFactory.createUpdateMeterTask(rpcTaskContext, input, cookie, convertorExecutor);
         ListenableFuture<RpcResult<UpdateMeterOutput>> result = task.submit();
 
         return result;
@@ -390,7 +392,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         LOG.debug("Calling the updatePort RPC method on MessageDispatchService");
 
         OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> task =
-                OFRpcTaskFactory.createUpdatePortTask(rpcTaskContext, input, null);
+                OFRpcTaskFactory.createUpdatePortTask(rpcTaskContext, input, null, convertorExecutor);
         return task.submit();
     }
 
@@ -399,7 +401,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         LOG.debug("Calling the updateTable RPC method on MessageDispatchService");
 
         OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>> task =
-                OFRpcTaskFactory.createUpdateTableTask(rpcTaskContext, input, null);
+                OFRpcTaskFactory.createUpdateTableTask(rpcTaskContext, input, null, convertorExecutor);
         return task.submit();
     }
 
@@ -429,7 +431,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         LOG.debug("Calling the getFlowStatisticsFromFlowTable RPC method on MessageDispatchService");
 
         OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>> task =
-                OFRpcTaskFactory.createGetFlowStatisticsFromFlowTableTask(rpcTaskContext, input, null);
+                OFRpcTaskFactory.createGetFlowStatisticsFromFlowTableTask(rpcTaskContext, input, null, convertorExecutor);
         return task.submit();
     }
 
@@ -449,7 +451,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         LOG.debug("Calling the getAggregateFlowStatisticsFromFlowTableForGivenMatch RPC method on MessageDispatchService");
 
         OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> task =
-                OFRpcTaskFactory.createGetAggregateFlowStatisticsFromFlowTableForGivenMatchTask(rpcTaskContext, input, null);
+                OFRpcTaskFactory.createGetAggregateFlowStatisticsFromFlowTableForGivenMatchTask(rpcTaskContext, input, null, convertorExecutor);
         return task.submit();
     }
 
index b2f69d32fe6423c90f44732b946ddcd77e4b1cbc..3bc86226cd97f3c4f641f559f2d5f0c84827327a 100644 (file)
@@ -28,7 +28,7 @@ import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
 import org.opendaylight.openflowplugin.api.openflow.md.core.sal.NotificationComposer;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.GroupConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.MeterConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PortConvertor;
@@ -203,27 +203,32 @@ public abstract class OFRpcTaskFactory {
      * @param taskContext task context
      * @param input flow object input
      * @param cookie switch connection distinguisher cookie value
+     * @param convertorExecutor
      * @return UpdateFlow task
      */
     public static OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> createAddFlowTask(
             OFRpcTaskContext taskContext, AddFlowInput input,
-            SwitchConnectionDistinguisher cookie) {
+            SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
 
         class OFRpcTaskImpl extends OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> {
 
-            public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie, AddFlowInput input) {
+            private final ConvertorExecutor convertorExecutor;
+            private final VersionDatapathIdConvertorData data;
+
+            public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie, AddFlowInput input, ConvertorExecutor convertorExecutor) {
                 super(taskContext, cookie, input);
+                this.convertorExecutor = convertorExecutor;
+                data = new VersionDatapathIdConvertorData(getVersion());
+                data.setDatapathId(getSession().getFeatures().getDatapathId());
             }
 
             @Override
             public ListenableFuture<RpcResult<UpdateFlowOutput>> call() {
                 ListenableFuture<RpcResult<UpdateFlowOutput>> result = SettableFuture.create();
-                final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
-                data.setDatapathId(getSession().getFeatures().getDatapathId());
 
                 // Convert the AddFlowInput to FlowModInput
                 final java.util.Optional<List<FlowModInputBuilder>> ofFlowModInputs =
-                        ConvertorManager.getInstance().convert(getInput(), data);
+                        convertorExecutor.convert(getInput(), data);
 
                 final List<FlowModInputBuilder> flowModInputs = ofFlowModInputs.orElse(Collections.emptyList());
                 LOG.debug("Number of flows to push to switch: {}", flowModInputs.size());
@@ -241,12 +246,12 @@ public abstract class OFRpcTaskFactory {
             }
         }
 
-        return new OFRpcTaskImpl(taskContext, cookie, input);
+        return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
     }
 
     /**
-     * Recursive helper method for {@link OFRpcTaskFactory#createAddFlowTask(OFRpcTaskContext, AddFlowInput, SwitchConnectionDistinguisher)}
-     * and {@link OFRpcTaskFactory#createUpdateFlowTask(OFRpcTaskContext, UpdateFlowInput, SwitchConnectionDistinguisher, ReadWriteTransaction)} to chain results
+     * Recursive helper method for {@link OFRpcTaskFactory#createAddFlowTask(OFRpcTaskContext, org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput, org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor)}
+     * and {@link OFRpcTaskFactory#createUpdateFlowTask(OFRpcTaskContext, org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput, org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher, org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor)} to chain results
      * of multiple flowmods.
      * The next flowmod gets executed if the earlier one is successful.
      * All the flowmods should have the same xid, in-order to cross-reference
@@ -318,19 +323,23 @@ public abstract class OFRpcTaskFactory {
      * @param input update flow input
      * @param cookie switch connection distinguisher cookie value
      * @param rwTx  read write transaction
+     * @param convertorExecutor
      * @return UpdateFlow task
      */
     public static OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> createUpdateFlowTask(
             final OFRpcTaskContext taskContext, UpdateFlowInput input,
-            SwitchConnectionDistinguisher cookie, final ReadWriteTransaction rwTx) {
+            SwitchConnectionDistinguisher cookie, final ReadWriteTransaction rwTx, ConvertorExecutor convertorExecutor) {
 
         class OFRpcTaskImpl extends OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> {
             final ReadWriteTransaction rwTx;
+            private final ConvertorExecutor convertorExecutor;
+            private final VersionDatapathIdConvertorData data;
             InstanceIdentifier<Table> iiToTable = null;
             String flowId = null;
             public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
-                    final UpdateFlowInput in, final ReadWriteTransaction rwTx) {
+                                 final UpdateFlowInput in, final ReadWriteTransaction rwTx, ConvertorExecutor convertorExecutor) {
                 super(taskContext, cookie, in);
+                this.convertorExecutor = convertorExecutor;
                 final FlowRef flowRef = in.getFlowRef();
                 if (flowRef != null) {
                     InstanceIdentifier<Flow> iiToFlow = (InstanceIdentifier<Flow>)(flowRef.getValue());
@@ -342,6 +351,8 @@ public abstract class OFRpcTaskFactory {
                     }
                 }
                 this.rwTx = rwTx;
+                data = new VersionDatapathIdConvertorData(getVersion());
+                data.setDatapathId(getSession().getFeatures().getDatapathId());
             }
 
             @Override
@@ -351,20 +362,17 @@ public abstract class OFRpcTaskFactory {
                 UpdateFlowInput in = getInput();
                 UpdatedFlow updated = in.getUpdatedFlow();
                 OriginalFlow original = in.getOriginalFlow();
-                Short version = getVersion();
 
                 List<FlowModInputBuilder> allFlowMods = new ArrayList<>();
                 java.util.Optional<List<FlowModInputBuilder>> ofFlowModInputs;
-                final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
-                data.setDatapathId(getSession().getFeatures().getDatapathId());
 
-                if (!FlowCreatorUtil.canModifyFlow(original, updated, version)) {
+                if (!FlowCreatorUtil.canModifyFlow(original, updated, getVersion())) {
                     // We would need to remove original and add updated.
 
                     //remove flow
                     RemoveFlowInputBuilder removeflow = new RemoveFlowInputBuilder(original);
                     java.util.Optional<List<FlowModInputBuilder>> ofFlowRemoveInput =
-                            ConvertorManager.getInstance().convert(removeflow.build(), data);
+                            convertorExecutor.convert(removeflow.build(), data);
 
                     if (ofFlowRemoveInput.isPresent()) {
                         // remove flow should be the first
@@ -372,9 +380,9 @@ public abstract class OFRpcTaskFactory {
                     }
 
                     AddFlowInputBuilder addFlowInputBuilder = new AddFlowInputBuilder(updated);
-                    ofFlowModInputs = ConvertorManager.getInstance().convert(addFlowInputBuilder.build(), data);
+                    ofFlowModInputs = convertorExecutor.convert(addFlowInputBuilder.build(), data);
                 } else {
-                    ofFlowModInputs = ConvertorManager.getInstance().convert(updated, data);
+                    ofFlowModInputs = convertorExecutor.convert(updated, data);
                 }
 
                 //deleting flow hash value from operational DS
@@ -437,7 +445,7 @@ public abstract class OFRpcTaskFactory {
                 return getInput().getUpdatedFlow().isBarrier();
             }
         }
-        return new OFRpcTaskImpl(taskContext, cookie, input, rwTx);
+        return new OFRpcTaskImpl(taskContext, cookie, input, rwTx, convertorExecutor);
     }
 
 
@@ -461,25 +469,30 @@ public abstract class OFRpcTaskFactory {
      * @param taskContext taks context
      * @param input group update input
      * @param cookie switch connection distinguisher cookie value
+     * @param convertorExecutor
      * @return update group task
      */
     public static OFRpcTask<AddGroupInput, RpcResult<UpdateGroupOutput>> createAddGroupTask(
             final OFRpcTaskContext taskContext, AddGroupInput input,
-            final SwitchConnectionDistinguisher cookie) {
+            final SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
         class OFRpcTaskImpl extends OFRpcTask<AddGroupInput, RpcResult<UpdateGroupOutput>> {
 
-            public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie, AddGroupInput input) {
+            private final ConvertorExecutor convertorExecutor;
+            private final VersionDatapathIdConvertorData data;
+
+            public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie, AddGroupInput input, ConvertorExecutor convertorExecutor) {
                 super(taskContext, cookie, input);
+                this.convertorExecutor = convertorExecutor;
+                data = new VersionDatapathIdConvertorData(getVersion());
+                data.setDatapathId(getSession().getFeatures().getDatapathId());
             }
 
             @Override
             public ListenableFuture<RpcResult<UpdateGroupOutput>> call() {
                 ListenableFuture<RpcResult<UpdateGroupOutput>> result = SettableFuture.create();
-                final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
-                data.setDatapathId(getSession().getFeatures().getDatapathId());
 
                 // Convert the AddGroupInput to GroupModInput
-                final java.util.Optional<GroupModInputBuilder> ofGroupModInput = ConvertorManager.getInstance().convert(getInput(), data);
+                final java.util.Optional<GroupModInputBuilder> ofGroupModInput = convertorExecutor.convert(getInput(), data);
                 final GroupModInputBuilder groupModInputBuilder = ofGroupModInput
                         .orElse(GroupConvertor.defaultResult(getVersion()))
                         .setXid(getSession().getNextXid());
@@ -500,7 +513,7 @@ public abstract class OFRpcTaskFactory {
             }
         };
 
-        return new OFRpcTaskImpl(taskContext, cookie, input);
+        return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
     }
 
 
@@ -525,15 +538,21 @@ public abstract class OFRpcTaskFactory {
      * @param taskContext task context
      * @param input meter add input
      * @param cookie switch connection distinguisher
+     * @param convertorExecutor
      * @return update meter task
      */
     public static OFRpcTask<AddMeterInput, RpcResult<UpdateMeterOutput>> createAddMeterTask(
             OFRpcTaskContext taskContext, AddMeterInput input,
-            SwitchConnectionDistinguisher cookie) {
+            SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
         class OFRpcTaskImpl extends OFRpcTask<AddMeterInput, RpcResult<UpdateMeterOutput>> {
 
-            public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie, AddMeterInput input) {
+            private final ConvertorExecutor convertorExecutor;
+            private final VersionConvertorData data;
+
+            public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie, AddMeterInput input, ConvertorExecutor convertorExecutor) {
                 super(taskContext, cookie, input);
+                this.convertorExecutor = convertorExecutor;
+                data = new VersionConvertorData(getVersion());
             }
 
             @Override
@@ -541,9 +560,7 @@ public abstract class OFRpcTaskFactory {
                 ListenableFuture<RpcResult<UpdateMeterOutput>> result = SettableFuture.create();
 
                 // Convert the AddMeterInput to UpdateMeterOutput
-                final java.util.Optional<MeterModInputBuilder> ofMeterModInput = ConvertorManager
-                        .getInstance()
-                        .convert(getInput(), new VersionConvertorData(getVersion()));
+                final java.util.Optional<MeterModInputBuilder> ofMeterModInput = convertorExecutor.convert(getInput(), data);
 
                 final MeterModInputBuilder meterModInputBuilder = ofMeterModInput
                         .orElse(MeterConvertor.defaultResult(getVersion()))
@@ -565,7 +582,7 @@ public abstract class OFRpcTaskFactory {
             }
         };
 
-        return new OFRpcTaskImpl(taskContext, cookie, input);
+        return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
     }
 
     /**
@@ -589,27 +606,32 @@ public abstract class OFRpcTaskFactory {
      * @param taskContext task context
      * @param input update group output
      * @param cookie switch connection distinguisher cookie value
+     * @param convertorExecutor
      * @return UpdateFlow task
      */
     public static OFRpcTask<UpdateGroupInput, RpcResult<UpdateGroupOutput>> createUpdateGroupTask(
             OFRpcTaskContext taskContext, UpdateGroupInput input,
-            SwitchConnectionDistinguisher cookie) {
+            SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
         class OFRpcTaskImpl extends OFRpcTask<UpdateGroupInput, RpcResult<UpdateGroupOutput>> {
 
+            private final ConvertorExecutor convertorExecutor;
+            private final VersionDatapathIdConvertorData data;
+
             public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
-                    UpdateGroupInput input) {
+                                 UpdateGroupInput input, ConvertorExecutor convertorExecutor) {
                 super(taskContext, cookie, input);
+                this.convertorExecutor = convertorExecutor;
+                data = new VersionDatapathIdConvertorData(getVersion());
+                data.setDatapathId(getSession().getFeatures().getDatapathId());
             }
 
             @Override
             public ListenableFuture<RpcResult<UpdateGroupOutput>> call() {
                 ListenableFuture<RpcResult<UpdateGroupOutput>> result = null;
-                final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
-                data.setDatapathId(getSession().getFeatures().getDatapathId());
 
                 // Convert the UpdateGroupInput to GroupModInput
                 final java.util.Optional<GroupModInputBuilder> ofGroupModInput =
-                        ConvertorManager.getInstance().convert(getInput().getUpdatedGroup(), data);
+                        convertorExecutor.convert(getInput().getUpdatedGroup(), data);
 
                 final GroupModInputBuilder groupModInputBuilder = ofGroupModInput
                         .orElse(GroupConvertor.defaultResult(getVersion()))
@@ -632,7 +654,7 @@ public abstract class OFRpcTaskFactory {
             }
         }
 
-        return new OFRpcTaskImpl(taskContext, cookie, input);
+        return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
     }
 
     /**
@@ -656,16 +678,22 @@ public abstract class OFRpcTaskFactory {
      * @param taskContext task context
      * @param input update meter input
      * @param cookie switch connection distinguisher cookie value
+     * @param convertorExecutor
      * @return update meter task
      */
     public static OFRpcTask<UpdateMeterInput, RpcResult<UpdateMeterOutput>> createUpdateMeterTask(
             OFRpcTaskContext taskContext, UpdateMeterInput input,
-            SwitchConnectionDistinguisher cookie) {
+            SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
         class OFRpcTaskImpl extends OFRpcTask<UpdateMeterInput, RpcResult<UpdateMeterOutput>> {
 
+            private final ConvertorExecutor convertorExecutor;
+            private final VersionConvertorData data;
+
             public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
-                    UpdateMeterInput input) {
+                                 UpdateMeterInput input, ConvertorExecutor convertorExecutor) {
                 super(taskContext, cookie, input);
+                this.convertorExecutor = convertorExecutor;
+                data = new VersionConvertorData(getVersion());
             }
 
             @Override
@@ -673,9 +701,7 @@ public abstract class OFRpcTaskFactory {
                 ListenableFuture<RpcResult<UpdateMeterOutput>> result = null;
 
                 // Convert the UpdateMeterInput to MeterModInput
-                final java.util.Optional<MeterModInputBuilder> ofMeterModInput = ConvertorManager
-                        .getInstance()
-                        .convert(getInput().getUpdatedMeter(), new VersionConvertorData(getVersion()));
+                final java.util.Optional<MeterModInputBuilder> ofMeterModInput = convertorExecutor.convert(getInput().getUpdatedMeter(), data);
 
                 final MeterModInputBuilder meterModInputBuilder = ofMeterModInput
                         .orElse(MeterConvertor.defaultResult(getVersion()))
@@ -696,7 +722,7 @@ public abstract class OFRpcTaskFactory {
             }
         }
 
-        return new OFRpcTaskImpl(taskContext, cookie, input);
+        return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
     }
 
     /**
@@ -721,27 +747,31 @@ public abstract class OFRpcTaskFactory {
      * @param taskContext task context
      * @param input update flow input
      * @param cookie switch connection distinguisher cookie value
+     * @param convertorExecutor
      * @return task remove flow task
      */
     public static OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>> createRemoveFlowTask(
             OFRpcTaskContext taskContext, RemoveFlowInput input,
-            SwitchConnectionDistinguisher cookie) {
+            SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
         class OFRpcTaskImpl extends OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>> {
 
+            private final VersionDatapathIdConvertorData data;
+            private final ConvertorExecutor convertorExecutor;
+
             public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
-                    RemoveFlowInput input) {
+                                 RemoveFlowInput input, ConvertorExecutor convertorExecutor) {
                 super(taskContext, cookie, input);
+                this.convertorExecutor = convertorExecutor;
+                data = new VersionDatapathIdConvertorData(getVersion());
+                data.setDatapathId(getSession().getFeatures().getDatapathId());
             }
 
             @Override
             public ListenableFuture<RpcResult<UpdateFlowOutput>> call() {
                 ListenableFuture<RpcResult<UpdateFlowOutput>> result = SettableFuture.create();
-                final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
-                data.setDatapathId(getSession().getFeatures().getDatapathId());
 
                 // Convert the AddFlowInput to FlowModInput
-                final java.util.Optional<List<FlowModInputBuilder>> ofFlowModInputs =
-                        ConvertorManager.getInstance().convert(getInput(), data);
+                final java.util.Optional<List<FlowModInputBuilder>> ofFlowModInputs = convertorExecutor.convert(getInput(), data);
 
                 result = chainFlowMods(ofFlowModInputs.orElse(Collections.emptyList()), 0, getTaskContext(), getCookie());
                 result = OFRpcTaskUtil.chainFutureBarrier(this, result);
@@ -758,7 +788,7 @@ public abstract class OFRpcTaskFactory {
             }
         }
 
-        return new OFRpcTaskImpl(taskContext, cookie, input);
+        return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
     }
 
     /**
@@ -783,27 +813,31 @@ public abstract class OFRpcTaskFactory {
      * @param taskContext task context
      * @param input remove group input
      * @param cookie switch connection distinguisher cookie value
+     * @param convertorExecutor
      * @return task remove group task
      */
     public static OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>> createRemoveGroupTask(
             final OFRpcTaskContext taskContext, RemoveGroupInput input,
-            final SwitchConnectionDistinguisher cookie) {
+            final SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
         class OFRpcTaskImpl extends OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>> {
 
+            private final ConvertorExecutor convertorExecutor;
+            private final VersionDatapathIdConvertorData data;
+
             public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
-                    RemoveGroupInput input) {
+                                 RemoveGroupInput input, ConvertorExecutor convertorExecutor) {
                 super(taskContext, cookie, input);
+                this.convertorExecutor = convertorExecutor;
+                data = new VersionDatapathIdConvertorData(getVersion());
+                data.setDatapathId(getSession().getFeatures().getDatapathId());
             }
 
             @Override
             public ListenableFuture<RpcResult<UpdateGroupOutput>> call() {
                 ListenableFuture<RpcResult<UpdateGroupOutput>> result = SettableFuture.create();
-                final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(getVersion());
-                data.setDatapathId(getSession().getFeatures().getDatapathId());
 
                 // Convert the AddGroupInput to GroupModInput
-                final java.util.Optional<GroupModInputBuilder> ofGroupModInput =
-                        ConvertorManager.getInstance().convert(getInput(), data);
+                final java.util.Optional<GroupModInputBuilder> ofGroupModInput = convertorExecutor.convert(getInput(), data);
 
                 final GroupModInputBuilder groupModInputBuilder = ofGroupModInput
                         .orElse(GroupConvertor.defaultResult(getVersion()))
@@ -825,7 +859,7 @@ public abstract class OFRpcTaskFactory {
             }
         }
 
-        return new OFRpcTaskImpl(taskContext, cookie, input);
+        return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
     }
 
     /**
@@ -849,17 +883,23 @@ public abstract class OFRpcTaskFactory {
      * @param taskContext task context
      * @param input meter removed input
      * @param cookie switch connection distinguisher cookie value
+     * @param convertorExecutor
      * @return task meter remove task
      */
     public static OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>> createRemoveMeterTask(
             OFRpcTaskContext taskContext, RemoveMeterInput input,
-            SwitchConnectionDistinguisher cookie) {
+            SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
 
         class OFRpcTaskImpl extends OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>> {
 
+            private final ConvertorExecutor convertorExecutor;
+            private final VersionConvertorData data;
+
             public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
-                    RemoveMeterInput input) {
+                                 RemoveMeterInput input, ConvertorExecutor convertorExecutor) {
                 super(taskContext, cookie, input);
+                this.convertorExecutor = convertorExecutor;
+                data = new VersionConvertorData(getVersion());
             }
 
             @Override
@@ -867,9 +907,7 @@ public abstract class OFRpcTaskFactory {
                 ListenableFuture<RpcResult<UpdateMeterOutput>> result = SettableFuture.create();
 
                 // Convert the RemoveMeterInput to UpdateMeterOutput
-                final java.util.Optional<MeterModInputBuilder> ofMeterModInput = ConvertorManager
-                        .getInstance()
-                        .convert(getInput(), new VersionConvertorData(getVersion()));
+                final java.util.Optional<MeterModInputBuilder> ofMeterModInput = convertorExecutor.convert(getInput(), data);
 
                 final MeterModInputBuilder meterModInputBuilder = ofMeterModInput
                         .orElse(MeterConvertor.defaultResult(getVersion()))
@@ -891,7 +929,7 @@ public abstract class OFRpcTaskFactory {
             }
         }
 
-        return new OFRpcTaskImpl(taskContext, cookie, input);
+        return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
 
     }
 
@@ -1623,18 +1661,22 @@ public abstract class OFRpcTaskFactory {
      * @param taskContext task context
      * @param input get flow statistics from flow table
      * @param cookie switch connection distinguisher cookie value
+     * @param convertorExecutor
      * @return task get flow statistics from flow table task
      */
     public static OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>>
     createGetFlowStatisticsFromFlowTableTask(
             final OFRpcTaskContext taskContext,
-            final GetFlowStatisticsFromFlowTableInput input, SwitchConnectionDistinguisher cookie) {
+            final GetFlowStatisticsFromFlowTableInput input, SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
 
         class OFRpcTaskImpl extends OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>> {
 
+            private final ConvertorExecutor convertorExecutor;
+
             public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
-                    GetFlowStatisticsFromFlowTableInput input) {
+                                 GetFlowStatisticsFromFlowTableInput input, ConvertorExecutor convertorExecutor) {
                 super(taskContext, cookie, input);
+                this.convertorExecutor = convertorExecutor;
             }
 
             @Override
@@ -1674,7 +1716,7 @@ public abstract class OFRpcTaskFactory {
 
                 // convert and inject match
                 MatchReactor.getInstance().convert(input.getMatch(), taskContext.getSession()
-                                .getPrimaryConductor().getVersion(), mprFlowRequestBuilder);
+                                .getPrimaryConductor().getVersion(), mprFlowRequestBuilder, convertorExecutor);
 
                 // Set request body to main multipart request
                 multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
@@ -1698,7 +1740,7 @@ public abstract class OFRpcTaskFactory {
             }
         }
 
-        return new OFRpcTaskImpl(taskContext, cookie, input);
+        return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
     }
 
     /**
@@ -1765,17 +1807,21 @@ public abstract class OFRpcTaskFactory {
      * @param taskContext task context
      * @param input aggregate flow statistics input
      * @param cookie switch connection distinguisher cookie value
+     * @param convertorExecutor
      * @return task task to fetch the statistics
      */
     public static OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>
     createGetAggregateFlowStatisticsFromFlowTableForGivenMatchTask(
             final OFRpcTaskContext taskContext,
-            final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input, SwitchConnectionDistinguisher cookie) {
+            final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input, SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
         class OFRpcTaskImpl extends OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> {
 
+            private final ConvertorExecutor convertorExecutor;
+
             public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
-                    GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
+                                 GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input, ConvertorExecutor convertorExecutor) {
                 super(taskContext, cookie, input);
+                this.convertorExecutor = convertorExecutor;
             }
 
             @Override
@@ -1801,7 +1847,7 @@ public abstract class OFRpcTaskFactory {
                 }
 
                 MatchReactor.getInstance().convert(input.getMatch(), taskContext.getSession()
-                                .getPrimaryConductor().getVersion(), mprAggregateRequestBuilder);
+                                .getPrimaryConductor().getVersion(), mprAggregateRequestBuilder, convertorExecutor);
 
                 FlowCreatorUtil.setWildcardedFlowMatch(taskContext.getSession()
                         .getPrimaryConductor().getVersion(), mprAggregateRequestBuilder);
@@ -1828,7 +1874,7 @@ public abstract class OFRpcTaskFactory {
             }
         }
 
-        return new OFRpcTaskImpl(taskContext, cookie, input);
+        return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
     }
 
     /**
@@ -2092,31 +2138,34 @@ public abstract class OFRpcTaskFactory {
      * @param taskContext task context
      * @param input update port input
      * @param cookie switch connection distinguisher cookie value
+     * @param convertorExecutor
      * @return task task to update port
      */
     public static OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> createUpdatePortTask(
             final OFRpcTaskContext taskContext, final UpdatePortInput input,
-            final SwitchConnectionDistinguisher cookie) {
+            final SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
 
         class OFRpcTaskImpl extends OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> {
 
+            private final ConvertorExecutor convertorExecutor;
+            private final VersionConvertorData data;
+
             public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
-                    UpdatePortInput input) {
+                                 UpdatePortInput input, ConvertorExecutor convertorExecutor) {
                 super(taskContext, cookie, input);
+                this.convertorExecutor = convertorExecutor;
+                data = new VersionConvertorData(getVersion());
             }
 
             @Override
             public ListenableFuture<RpcResult<UpdatePortOutput>> call() {
                 ListenableFuture<RpcResult<UpdatePortOutput>> result = SettableFuture.create();
-                final short version = taskContext.getSession().getPrimaryConductor().getVersion();
                 final Port inputPort = input.getUpdatedPort().getPort().getPort().get(0);
 
-                final java.util.Optional<PortModInput> ofPortModInput = ConvertorManager
-                        .getInstance()
-                        .convert(inputPort, new VersionConvertorData(version));
+                final java.util.Optional<PortModInput> ofPortModInput = convertorExecutor.convert(inputPort, data);
 
                 PortModInputBuilder mdInput = new PortModInputBuilder(ofPortModInput
-                        .orElse(PortConvertor.defaultResult(version)))
+                        .orElse(PortConvertor.defaultResult(getVersion())))
                         .setXid(taskContext.getSession().getNextXid());
 
                 Future<RpcResult<UpdatePortOutput>> resultFromOFLib = getMessageService()
@@ -2127,24 +2176,30 @@ public abstract class OFRpcTaskFactory {
             }
         }
 
-        return new OFRpcTaskImpl(taskContext, cookie, input);
+        return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
     }
 
     /**
      * @param taskContext task context
      * @param input update table input
      * @param cookie switch connection distinguisher cookie value
+     * @param convertorExecutor
      * @return task task to udpate table input
      */
     public static OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>> createUpdateTableTask(
             final OFRpcTaskContext taskContext, final UpdateTableInput input,
-            final SwitchConnectionDistinguisher cookie) {
+            final SwitchConnectionDistinguisher cookie, ConvertorExecutor convertorExecutor) {
 
         class OFRpcTaskImpl extends OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>> {
 
+            private final ConvertorExecutor convertorExecutor;
+            private final VersionConvertorData data;
+
             public OFRpcTaskImpl(OFRpcTaskContext taskContext, SwitchConnectionDistinguisher cookie,
-                    UpdateTableInput input) {
+                                 UpdateTableInput input, ConvertorExecutor convertorExecutor) {
                 super(taskContext, cookie, input);
+                this.convertorExecutor = convertorExecutor;
+                data = new VersionConvertorData(getVersion());
             }
 
             @Override
@@ -2156,7 +2211,7 @@ public abstract class OFRpcTaskFactory {
                 MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
                 MultipartRequestTableFeaturesBuilder requestBuilder = new MultipartRequestTableFeaturesBuilder();
 
-                final java.util.Optional<List<TableFeatures>> ofTableFeatureList = ConvertorManager.getInstance().convert(input.getUpdatedTable());
+                final java.util.Optional<List<TableFeatures>> ofTableFeatureList = convertorExecutor.convert(input.getUpdatedTable(), data);
                 requestBuilder.setTableFeatures(ofTableFeatureList.orElse(Collections.emptyList()));
                 caseBuilder.setMultipartRequestTableFeatures(requestBuilder.build());
 
@@ -2182,7 +2237,7 @@ public abstract class OFRpcTaskFactory {
             }
         }
 
-        return new OFRpcTaskImpl(taskContext, cookie, input);
+        return new OFRpcTaskImpl(taskContext, cookie, input, convertorExecutor);
     }
 
     public static OFRpcTask<SetConfigInput, RpcResult<SetConfigOutput>> createSetNodeConfigTask(final OFRpcTaskContext taskContext,
index 58754980b056e55a3ea56f20250fa08864831720..dd88be1c5ea5883b13b4d9316781d2ef7f81e617 100644 (file)
@@ -22,6 +22,8 @@ import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionCon
 import org.opendaylight.openflowplugin.openflow.md.core.MDController;
 import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionConverterManagerImpl;
 import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFRoleManager;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
 import org.opendaylight.openflowplugin.statistics.MessageSpyCounterImpl;
@@ -67,6 +69,8 @@ public class OpenflowPluginProvider implements AutoCloseable, OpenFlowPluginExte
      * Initialization of services and msgSpy counter
      */
     public void initialization() {
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+
         messageCountProvider = new MessageSpyCounterImpl();
         extensionConverterManager = new ExtensionConverterManagerImpl();
         roleManager = new OFRoleManager(OFSessionUtil.getSessionManager());
@@ -76,14 +80,14 @@ public class OpenflowPluginProvider implements AutoCloseable, OpenFlowPluginExte
         entManager.init();
 
         LOG.debug("dependencies gathered..");
-        registrationManager = new SalRegistrationManager();
+        registrationManager = new SalRegistrationManager(convertorManager);
         registrationManager.setDataService(dataBroker);
         registrationManager.setPublishService(notificationService);
         registrationManager.setRpcProviderRegistry(rpcRegistry);
         registrationManager.setOfEntityManager(entManager);
         registrationManager.init();
 
-        mdController = new MDController();
+        mdController = new MDController(convertorManager);
         mdController.setSwitchConnectionProviders(switchConnectionProviders);
         mdController.setMessageSpyCounter(messageCountProvider);
         mdController.setExtensionConverterProvider(extensionConverterManager);
index ec72db0329f9effd5e26fd371b09747e901016c8..7f3ce58b63135006f9f9eca8aa363476da7a6c34 100644 (file)
@@ -24,6 +24,7 @@ import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionListe
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionManager;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessionKeyOF;
 import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
@@ -53,6 +54,7 @@ import org.slf4j.LoggerFactory;
 public class SalRegistrationManager implements SessionListener, AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(SalRegistrationManager.class);
+    private final ConvertorExecutor convertorExecutor;
 
     private NotificationProviderService publishService;
 
@@ -66,7 +68,8 @@ public class SalRegistrationManager implements SessionListener, AutoCloseable {
 
     private OfEntityManager entManager;
 
-    public SalRegistrationManager() {
+    public SalRegistrationManager(ConvertorExecutor convertorExecutor) {
+        this.convertorExecutor = convertorExecutor;
         swFeaturesUtil = SwitchFeaturesUtil.getInstance();
     }
 
@@ -105,7 +108,7 @@ public class SalRegistrationManager implements SessionListener, AutoCloseable {
         InstanceIdentifier<Node> identifier = identifierFromDatapathId(datapathId);
         NodeRef nodeRef = new NodeRef(identifier);
         NodeId nodeId = nodeIdFromDatapathId(datapathId);
-        ModelDrivenSwitch ofSwitch = new ModelDrivenSwitchImpl(nodeId, identifier,context);
+        ModelDrivenSwitch ofSwitch = new ModelDrivenSwitchImpl(nodeId, identifier, context, convertorExecutor);
 
         NotificationQueueWrapper wrappedNotification = new NotificationQueueWrapper(
                 nodeAdded(ofSwitch, features, nodeRef),
index cc30512e32dbff4f1693689a4d52cacbcb753c05..191b21d241fd20eb6d5652d60f9d2040ae54e35d 100644 (file)
@@ -8,23 +8,17 @@
 
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
 
-import java.util.ArrayList;
+import com.google.common.annotations.VisibleForTesting;
+import java.util.Arrays;
 import java.util.Collection;
-import java.util.List;
+import java.util.Collections;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
-import javax.annotation.Nullable;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionResponseConvertor;
+import java.util.stream.Stream;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowInstructionResponseConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowStatsResponseConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchResponseConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchV10ResponseConvertor;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -34,75 +28,54 @@ import org.slf4j.LoggerFactory;
  */
 public class ConvertorManager implements ConvertorExecutor, ConvertorRegistrator {
     private static final Logger LOG = LoggerFactory.getLogger(ConvertorManager.class);
-    private static ConvertorManager INSTANCE;
-
-    static {
-        INSTANCE = new ConvertorManager();
-        // All convertors are registered here
-        INSTANCE.registerConvertor(new TableFeaturesConvertor());
-        INSTANCE.registerConvertor(new TableFeaturesResponseConvertor());
-        INSTANCE.registerConvertor(new MeterConvertor());
-        INSTANCE.registerConvertor(new MeterStatsResponseConvertor());
-        INSTANCE.registerConvertor(new MeterConfigStatsResponseConvertor());
-        INSTANCE.registerConvertor(new PortConvertor());
-        // TODO: Add MatchConvertor
-        INSTANCE.registerConvertor(new MatchResponseConvertor());
-        INSTANCE.registerConvertor(new MatchV10ResponseConvertor());
-        INSTANCE.registerConvertor(new ActionConvertor());
-        INSTANCE.registerConvertor(new ActionResponseConvertor());
-        INSTANCE.registerConvertor(new GroupConvertor());
-        INSTANCE.registerConvertor(new GroupDescStatsResponseConvertor());
-        INSTANCE.registerConvertor(new GroupStatsResponseConvertor());
-        INSTANCE.registerConvertor(new PacketOutConvertor());
-        INSTANCE.registerConvertor(new FlowConvertor());
-        INSTANCE.registerConvertor(new FlowInstructionResponseConvertor());
-        INSTANCE.registerConvertor(new FlowStatsResponseConvertor());
-    }
-
-    // Actual convertor keys
-    private List<Class<? extends DataContainer>> convertorKeys = new ArrayList<>();
 
     // Cache, that holds all registered convertors, but they can have multiple keys,
     // based on instanceof checks in the convert method
-    private Map<Class<? extends DataContainer>, Convertor> convertors = new ConcurrentHashMap<>();
-
-    private ConvertorManager() {
-        // Hiding implicit constructor
-    }
+    private Map<Short, Map<Class<? extends DataContainer>, Convertor<?, ?, ? extends ConvertorData>>> convertors;
 
     /**
-     * Gets instance of Convertor Manager.
-     *
-     * @return the instance
+     * Create new instance of Convertor Manager
+     * @param supportedVersions supported versions
      */
-    public static ConvertorManager getInstance() {
-        return INSTANCE;
+    public ConvertorManager(final Short... supportedVersions) {
+        final Stream<Short> stream = Arrays.stream(supportedVersions);
+
+        if (supportedVersions.length == 1) {
+            final Optional<Short> versionOptional = stream.findFirst();
+            versionOptional.ifPresent(version -> convertors = Collections.singletonMap(version, new ConcurrentHashMap<>()));
+        } else {
+            convertors = new ConcurrentHashMap<>();
+            stream.forEach(version -> convertors.putIfAbsent(version, new ConcurrentHashMap<>()));
+        }
     }
 
     @Override
-    @SuppressWarnings("unchecked")
-    public void registerConvertor(final Convertor convertor) {
-        for (final Object typeRaw : convertor.getTypes()) {
-            final Class<? extends DataContainer> type = (Class<? extends DataContainer>)typeRaw;
-            final Convertor result = convertors.get(type);
-
-            if (Objects.isNull(result)) {
-                convertorKeys.add(type);
-                convertors.put(type, convertor);
-                LOG.debug("{} is now converted by {}", type, convertor);
-            } else {
-                LOG.warn("Convertor for type {} is already registered", type);
+    public ConvertorManager registerConvertor(final short version, final Convertor<?, ?, ? extends ConvertorData> convertor) {
+        final Map<Class<? extends DataContainer>, Convertor<?, ?, ? extends ConvertorData>> convertorsForVersion =
+                convertors.get(version);
+
+        if (Objects.nonNull(convertorsForVersion)) {
+            for (final Class<? extends DataContainer> type : convertor.getTypes()) {
+                final Convertor<?, ?, ? extends ConvertorData> result = convertorsForVersion.get(type);
+
+                if (Objects.isNull(result)) {
+                    convertor.setConvertorExecutor(this);
+                    convertorsForVersion.put(type, convertor);
+                    LOG.debug("{} for version {} is now converted by {}", type, version, convertor);
+                } else {
+                    LOG.warn("{} for version {} have already registered convertor", type, version);
+                }
             }
+        } else {
+            LOG.warn("{} do not supports version {}", this, version);
         }
-    }
 
-    public <FROM extends DataContainer, TO> Optional<TO> convert(final FROM source) {
-        return convert(source, null);
+        return this;
     }
 
     @Override
     @SuppressWarnings("unchecked")
-    public <FROM extends DataContainer, TO, DATA extends ConvertorData> Optional<TO> convert(final FROM source, @Nullable final DATA data) {
+    public <FROM extends DataContainer, TO, DATA extends ConvertorData> Optional<TO> convert(final FROM source, final DATA data) {
         Optional<TO> result = Optional.empty();
 
         if (Objects.isNull(source)) {
@@ -113,26 +86,17 @@ public class ConvertorManager implements ConvertorExecutor, ConvertorRegistrator
         final Class<? extends DataContainer> type = source.getImplementedInterface();
 
         if (Objects.isNull(type)) {
-            LOG.warn("Cannot extract type from source, because getImplementedInterface() returns null");
+            LOG.warn("Cannot extract type from {}, because getImplementedInterface() returns null", source);
             return result;
         }
 
-        final Optional<Convertor> convertor = findConvertor(type);
-
-        if (convertor.isPresent()) {
-            result = Optional.of((TO) convertor.get().convert(source, data));
-        }
-
-        return result;
-    }
-
-    public <FROM extends DataContainer, TO> Optional<TO> convert(final Collection<FROM> source) {
-        return convert(source, null);
+         return findConvertor(data.getVersion(), type)
+                .map(convertor -> (TO)convertor.convert(source, data));
     }
 
     @Override
     @SuppressWarnings("unchecked")
-    public <FROM extends DataContainer, TO, DATA extends ConvertorData> Optional<TO> convert(final Collection<FROM> source, @Nullable final DATA data) {
+    public <FROM extends DataContainer, TO, DATA extends ConvertorData> Optional<TO> convert(final Collection<FROM> source, final DATA data) {
         Optional<TO> result = Optional.empty();
 
         if (Objects.isNull(source)) {
@@ -150,17 +114,12 @@ public class ConvertorManager implements ConvertorExecutor, ConvertorRegistrator
         final Class<? extends DataContainer> type = first.get().getImplementedInterface();
 
         if (Objects.isNull(type)) {
-            LOG.warn("Cannot extract type from source, because getImplementedInterface() returns null");
+            LOG.warn("Cannot extract type from {}, because getImplementedInterface() returns null", source);
             return result;
         }
 
-        final Optional<Convertor> convertor = findConvertor(type);
-
-        if (convertor.isPresent()) {
-            result = Optional.of((TO) convertor.get().convert(source, data));
-        }
-
-        return result;
+        return findConvertor(data.getVersion(), type)
+                .map(convertor -> (TO)convertor.convert(source, data));
     }
 
     /**
@@ -170,23 +129,36 @@ public class ConvertorManager implements ConvertorExecutor, ConvertorRegistrator
      * @param type input type
      * @return found convertor
      */
-    private Optional<Convertor> findConvertor(final Class<? extends DataContainer> type) {
-        Optional<Convertor> convertor = Optional.ofNullable(convertors.get(type));
-
-        if (!convertor.isPresent()) {
-            for (final Class<? extends DataContainer> key : convertorKeys) {
-                if (key.isAssignableFrom(type)) {
-                    final Convertor foundConvertor = convertors.get(key);
-                    convertor = Optional.ofNullable(foundConvertor);
-                    convertors.put(type, foundConvertor);
-                    LOG.warn("{} is now converted by {} using last resort method", type, foundConvertor);
-                    break;
-                }
-            }
+    @VisibleForTesting
+    Optional<Convertor> findConvertor(final short version, final Class<? extends DataContainer> type) {
+        final Map<Class<? extends DataContainer>, Convertor<?, ?, ? extends ConvertorData>> convertorsForVersion =
+                convertors.get(version);
+
+        Optional<Convertor> convertor = Optional.empty();
+
+        if (Objects.nonNull(convertorsForVersion)) {
+            convertor = Optional.ofNullable(convertorsForVersion.get(type));
 
             if (!convertor.isPresent()) {
-                LOG.warn("Convertor for {} not found", type);
+                for (final Class<? extends DataContainer> convertorType : convertorsForVersion.keySet()) {
+                    if (type.isAssignableFrom(convertorType)) {
+                        final Convertor<?, ?, ? extends ConvertorData> foundConvertor = convertorsForVersion.get(convertorType);
+                        convertor = Optional.ofNullable(foundConvertor);
+
+                        if (convertor.isPresent()) {
+                            convertorsForVersion.put(type, foundConvertor);
+                            LOG.warn("{} for version {} is now converted by {} using last resort method", type, version, foundConvertor);
+                            break;
+                        }
+                    }
+                }
+
+                if (!convertor.isPresent()) {
+                    LOG.warn("Convertor for {} for version {} not found", type, version);
+                }
             }
+        } else {
+            LOG.warn("{} do not supports version {}", this, version);
         }
 
         return convertor;
diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/ConvertorManagerFactory.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/ConvertorManagerFactory.java
new file mode 100644 (file)
index 0000000..5111912
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
+
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionResponseConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowInstructionResponseConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowStatsResponseConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchResponseConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchV10ResponseConvertor;
+
+/**
+ * Convertor manager factory.
+ */
+public class ConvertorManagerFactory {
+    /**
+     * Create default convertor manager.
+     *
+     * @return the convertor manager
+     */
+    public static ConvertorManager createDefaultManager() {
+        final TableFeaturesConvertor tableFeaturesConvertor = new TableFeaturesConvertor();
+        final TableFeaturesResponseConvertor tableFeaturesResponseConvertor = new TableFeaturesResponseConvertor();
+        final MeterConvertor meterConvertor = new MeterConvertor();
+        final MeterStatsResponseConvertor meterStatsResponseConvertor = new MeterStatsResponseConvertor();
+        final MeterConfigStatsResponseConvertor meterConfigStatsResponseConvertor = new MeterConfigStatsResponseConvertor();
+        final PortConvertor portConvertor = new PortConvertor();
+        final MatchResponseConvertor matchResponseConvertor = new MatchResponseConvertor();
+        final MatchV10ResponseConvertor matchV10ResponseConvertor = new MatchV10ResponseConvertor();
+        final ActionConvertor actionConvertor = new ActionConvertor();
+        final ActionResponseConvertor actionResponseConvertor = new ActionResponseConvertor();
+        final GroupConvertor groupConvertor = new GroupConvertor();
+        final GroupDescStatsResponseConvertor groupDescStatsResponseConvertor = new GroupDescStatsResponseConvertor();
+        final GroupStatsResponseConvertor groupStatsResponseConvertor = new GroupStatsResponseConvertor();
+        final PacketOutConvertor packetOutConvertor = new PacketOutConvertor();
+        final FlowConvertor flowConvertor = new FlowConvertor();
+        final FlowInstructionResponseConvertor flowInstructionResponseConvertor = new FlowInstructionResponseConvertor();
+        final FlowStatsResponseConvertor flowStatsResponseConvertor = new FlowStatsResponseConvertor();
+
+        return new ConvertorManager(OFConstants.OFP_VERSION_1_0, OFConstants.OFP_VERSION_1_3)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, tableFeaturesConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, tableFeaturesConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, tableFeaturesResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, tableFeaturesResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, meterConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, meterConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, meterStatsResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, meterStatsResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, meterConfigStatsResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, meterConfigStatsResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, portConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, portConvertor)
+                // TODO: Add MatchConvertorImpl and MatchConvertorV10Impl
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, matchResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, matchV10ResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, actionConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, actionConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, actionResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, actionResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, groupConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, groupConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, groupDescStatsResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, groupDescStatsResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, groupStatsResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, groupStatsResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, packetOutConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, packetOutConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, flowConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, flowConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, flowInstructionResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, flowInstructionResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_0, flowStatsResponseConvertor)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, flowStatsResponseConvertor);
+    }
+}
index 8bc40cdb5662c410bfad0b686b94c0ab06430c91..f5dbc591353d6e750f279e32fbf20618fcf537a4 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
 
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData;
 
 public interface ConvertorRegistrator {
     /**
@@ -16,5 +17,5 @@ public interface ConvertorRegistrator {
      *
      * @param convertor the convertor
      */
-    void registerConvertor(final Convertor convertor);
+    ConvertorManager registerConvertor(final short version, final Convertor<?, ?, ? extends ConvertorData> convertor);
 }
\ No newline at end of file
index 1d8e648842cd388c359e4a21f66be1fa187d5dc4..527da0910d37db00ef8c9f46c18af15ffa8ea647 100644 (file)
@@ -48,13 +48,12 @@ import org.slf4j.LoggerFactory;
  * {@code
  * VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
  * data.setDatapathId(datapathId);
- * Optional<GroupModInputBuilder> ofGroup = ConvertorManager.getInstance().convert(salGroup, data);
+ * Optional<GroupModInputBuilder> ofGroup = convertorManager.convert(salGroup, data);
  * }
  * </pre>
  */
-public class GroupConvertor implements Convertor<Group, GroupModInputBuilder, VersionDatapathIdConvertorData> {
+public class GroupConvertor extends Convertor<Group, GroupModInputBuilder, VersionDatapathIdConvertorData> {
     private static final List<Class<? extends DataContainer>> TYPES = Arrays.asList(Group.class, AddGroupInput.class, RemoveGroupInput.class, UpdatedGroup.class);
-
     /**
      * Create default empty group mod input builder
      * Use this method, if result from convertor is empty.
@@ -78,7 +77,7 @@ public class GroupConvertor implements Convertor<Group, GroupModInputBuilder, Ve
         return bucket1.getBucketId().getValue().compareTo(bucket2.getBucketId().getValue());
     };
 
-    private static List<BucketsList> salToOFBucketList(Buckets buckets, short version, int groupType, BigInteger datapathid) {
+    private List<BucketsList> salToOFBucketList(Buckets buckets, short version, int groupType, BigInteger datapathid) {
         final List<BucketsList> bucketLists = new ArrayList<>();
         final ActionConvertorData data = new ActionConvertorData(version);
         data.setDatapathId(datapathid);
@@ -91,7 +90,7 @@ public class GroupConvertor implements Convertor<Group, GroupModInputBuilder, Ve
             salToOFBucketListWatchGroup(groupBucket, bucketBuilder, groupType);
             salToOFBucketListWatchPort(groupBucket, bucketBuilder, groupType);
 
-            Optional<List<Action>> bucketActionList = ConvertorManager.getInstance().convert(
+            Optional<List<Action>> bucketActionList = getConvertorExecutor().convert(
                     groupBucket.getAction(), data);
 
             bucketBuilder.setAction(bucketActionList.orElse(Collections.emptyList()));
index ffb0450e4b175fdd149e1b6ec74378934ba04ec9..6b58fa33fe82016184bc7b4f1d261f1b1791c110 100644 (file)
@@ -41,11 +41,11 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  * <pre>
  * {@code
  * VersionConvertorData data = new VersionConvertorData(version);
- * Optional<List<GroupDescStats>> salGroupStats = ConvertorManager.getInstance().convert(ofGroupStats, data);
+ * Optional<List<GroupDescStats>> salGroupStats = convertorManager.convert(ofGroupStats, data);
  * }
  * </pre>
  */
-public class GroupDescStatsResponseConvertor implements Convertor<List<GroupDesc>, List<GroupDescStats>, VersionConvertorData> {
+public class GroupDescStatsResponseConvertor extends Convertor<List<GroupDesc>, List<GroupDescStats>, VersionConvertorData> {
 
     private static final Set<Class<? extends DataContainer>> TYPES = Collections.singleton(GroupDesc.class);
 
@@ -61,7 +61,7 @@ public class GroupDescStatsResponseConvertor implements Convertor<List<GroupDesc
         for (BucketsList bucketDetails : bucketDescStats) {
             BucketBuilder bucketDesc = new BucketBuilder();
             final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>> convertedSalActions =
-                    ConvertorManager.getInstance().convert(
+                    getConvertorExecutor().convert(
                             bucketDetails.getAction(), data);
 
 
index 861770a08e0c811043e7a12f4ceb0d11e2e99dae..aea519d4d9320c268be3d2570dcdda46a8327f67 100644 (file)
@@ -37,11 +37,12 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  * Example usage:
  * <pre>
  * {@code
- * Optional<List<GroupStats>> salGroupStats = ConvertorManager.getInstance().convert(ofGroupStats);
+ * VersionConvertorData data = new VersionConvertorData(version);
+ * Optional<List<GroupStats>> salGroupStats = convertorManager.convert(ofGroupStats, data);
  * }
  * </pre>
  */
-public class GroupStatsResponseConvertor implements Convertor<
+public class GroupStatsResponseConvertor extends Convertor<
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStats>,
         List<GroupStats>,
         VersionConvertorData> {
index 6a46bdeb84b26054e1c164ff9803d82fb65eec26..218c5457a75fe6164214212b12cec95a47183c38 100644 (file)
@@ -46,12 +46,12 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  * Example usage:
  * <pre>
  * {@code
- * Optional<List<MeterConfigStats>> salMeterConfigStats = ConvertorManager.getInstance().convert(
- *  ofMeterConfigStats);
+ * VersionConvertorData data = new VersionConvertorData(version);
+ * Optional<List<MeterConfigStats>> salMeterConfigStats = convertorManager.convert(ofMeterConfigStats, data);
  * }
  * </pre>
  */
-public class MeterConfigStatsResponseConvertor implements Convertor<List<MeterConfig>, List<MeterConfigStats>, VersionConvertorData> {
+public class MeterConfigStatsResponseConvertor extends Convertor<List<MeterConfig>, List<MeterConfigStats>, VersionConvertorData> {
 
     private static final Set<Class<? extends DataContainer>> TYPES = Collections.singleton(MeterConfig.class);
 
index 50e376a7107d7379c521a70220645b23dbcbf068..8a7dc4274553a09f66ebab7dc7a6808df3e61ec2 100644 (file)
@@ -51,11 +51,11 @@ import org.slf4j.LoggerFactory;
  * <pre>
  * {@code
  * VersionConvertorData data = new VersionConvertorData(version);
- * Optional<MeterModInputBuilder> ofMeter = ConvertorManager.getInstance().convert(salMeter, data);
+ * Optional<MeterModInputBuilder> ofMeter = convertorManager.convert(salMeter, data);
  * }
  * </pre>
  */
-public class MeterConvertor implements Convertor<Meter, MeterModInputBuilder, VersionConvertorData> {
+public class MeterConvertor extends Convertor<Meter, MeterModInputBuilder, VersionConvertorData> {
     private static final Logger LOG = LoggerFactory.getLogger(MeterConvertor.class);
     private static final List<Class<? extends DataContainer>> TYPES = Arrays.asList(Meter.class, AddMeterInput.class, RemoveMeterInput.class, UpdatedMeter.class);
 
index 270c20b78804eccf71c45b55d8f709c0ce780573..654e8cde9787e818926c211311fa4a141edfa9bc 100644 (file)
@@ -36,12 +36,12 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  * Example usage:
  * <pre>
  * {@code
- * Optional<List<MeterStats>> salMeterStats = ConvertorManager.getInstance().convert(
- *  ofMeterStats);
+ * VersionConvertorData data = new VersionConvertorData(version);
+ * Optional<List<MeterStats>> salMeterStats = convertorManager.convert(ofMeterStats, data);
  * }
  * </pre>
  */
-public class MeterStatsResponseConvertor implements Convertor<
+public class MeterStatsResponseConvertor extends Convertor<
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply
                 .multipart.reply.body.multipart.reply.meter._case.multipart.reply.meter.MeterStats>,
         List<MeterStats>,
index 7f8a2dc79ba9dd64a6c9ac53b6c81e01cf3b304e..bc320215b8e2b9a7e18a7757eeb25eef43db7c85 100644 (file)
@@ -47,11 +47,11 @@ import org.slf4j.LoggerFactory;
  * PacketOutConvertorData data = new PacketOutConvertorData(version);
  * data.setDatapathId(datapathId);
  * data.setXid(xid);
- * Optional<PacketOutInput> ofPacketInput = ConvertorManager.getInstance().convert(salPacket, data);
+ * Optional<PacketOutInput> ofPacketInput = convertorManager.convert(salPacket, data);
  * }
  * </pre>
  */
-public class PacketOutConvertor implements Convertor<TransmitPacketInput, PacketOutInput, PacketOutConvertorData> {
+public class PacketOutConvertor extends Convertor<TransmitPacketInput, PacketOutInput, PacketOutConvertorData> {
     private static final Logger LOG = LoggerFactory.getLogger(PacketOutConvertor.class);
     private static final Set<Class<? extends DataContainer>> TYPES = Collections.singleton(TransmitPacketInput.class);
 
@@ -127,7 +127,7 @@ public class PacketOutConvertor implements Convertor<TransmitPacketInput, Packet
             final ActionConvertorData actionConvertorData = new ActionConvertorData(data.getVersion());
             actionConvertorData.setDatapathId(data.getDatapathId());
 
-            final Optional<List<Action>> convertedActions = ConvertorManager.getInstance().convert(
+            final Optional<List<Action>> convertedActions = getConvertorExecutor().convert(
                     inputActions, actionConvertorData);
 
             actions = convertedActions.orElse(Collections.emptyList());
index 2671a8cff3a67c5d643a088790a218ddc7e556cb..bd27e212641203b046b504817686cb4b2bc33a6e 100644 (file)
@@ -37,11 +37,11 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  * <pre>
  * {@code
  * VersionConvertorData data = new VersionConvertorData(version);
- * Optional<PortModInput> ofPort = ConvertorManager.getInstance().convert(salPort, data);
+ * Optional<PortModInput> ofPort = convertorManager.convert(salPort, data);
  * }
  * </pre>
  */
-public class PortConvertor implements Convertor<Port, PortModInput, VersionConvertorData> {
+public class PortConvertor extends Convertor<Port, PortModInput, VersionConvertorData> {
 
     private static final Set<Class<? extends DataContainer>> TYPES = Collections.singleton(Port.class);
 
index 1ab65e6693c57fca0d68e103f267f4b393a46360..38b1935b32e22079253b3eaf096bc5eceb6d2192 100644 (file)
@@ -158,11 +158,12 @@ import org.slf4j.LoggerFactory;
  * Example usage:
  * <pre>
  * {@code
- * Optional<List<TableFeatures>> ofFeatures = ConvertorManager.getInstance().convert(salTableFeatures);
+ * VersionConvertorData data = new VersionConvertorData(version);
+ * Optional<List<TableFeatures>> ofFeatures = convertorManager..convert(salTableFeatures, data);
  * }
  * </pre>
  */
-public class TableFeaturesConvertor implements Convertor<
+public class TableFeaturesConvertor extends Convertor<
         org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableFeatures,
         List<TableFeatures>,
         VersionConvertorData> {
index bfc45f5440bc6315a5dc86a6ea3e038774026b71..04c7e72ef5e5eb3377faa0f4b1baceeec5faae5d 100644 (file)
@@ -175,11 +175,12 @@ import org.slf4j.LoggerFactory;
  * Example usage:
  * <pre>
  * {@code
- * Optional<List<TableFeatures>> salFeatures = ConvertorManager.getInstance().convert(ofTableFeatures);
+ * VersionConvertorData data = new VersionConvertorData(version);
+ * Optional<List<TableFeatures>> salFeatures = convertorManager.convert(ofTableFeatures, data);
  * }
  * </pre>
  */
-public class TableFeaturesResponseConvertor implements Convertor<MultipartReplyTableFeatures, List<TableFeatures>, VersionConvertorData> {
+public class TableFeaturesResponseConvertor extends Convertor<MultipartReplyTableFeatures, List<TableFeatures>, VersionConvertorData> {
     private static final Logger LOG = LoggerFactory.getLogger(TableFeaturesResponseConvertor.class);
     private static final Map<TableFeaturesPropType, ActionExecutor> TABLE_FEATURE_PROPERTY_TYPE_TO_ACTION;
     private static final Map<Class<?>, org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> OF_TO_SAL_ACTION;
index 4c808af23d325b70dc2a21523cdb1146ca74a9d3..55582b5ab57cd3d5ea95e895a9e6cee18b4031fa 100644 (file)
@@ -70,11 +70,11 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  * ActionConvertorData data = new ActionConvertorData(version);
  * data.setDatapathId(datapathId);
  * data.setIpProtocol(ipProtocol);
- * Optional<List<Action>> ofActions = ConvertorManager.getInstance().convert(salActions, data);
+ * Optional<List<Action>> ofActions = convertorManager.convert(salActions, data);
  * }
  * </pre>
  */
-public final class ActionConvertor implements Convertor<
+public final class ActionConvertor extends Convertor<
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>,
         List<Action>,
         ActionConvertorData> {
@@ -143,7 +143,7 @@ public final class ActionConvertor implements Convertor<
         // Iterate over SAL actions, run them through tokenizer and then add them to list of converted actions
         if (source != null) {
             for (final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action action : source) {
-                final Optional<Action> convertedAction = PROCESSOR.process(action.getAction(), data);
+                final Optional<Action> convertedAction = PROCESSOR.process(action.getAction(), data, getConvertorExecutor());
 
                 if (convertedAction.isPresent()) {
                     result.add(convertedAction.get());
index 1a69ab61daeb3f951bc5481cc2dc51aa1ba73abc..c689b0c8a512de75addd2fca8435f7f0e7a8dce6 100644 (file)
@@ -49,11 +49,11 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  * {@code
  * ActionResponseConvertorData data = new ActionResponseConvertorData(version);
  * data.setActionPath(actionPath);
- * Optional<List<Action>> salActions = ConvertorManager.getInstance().convert(ofActions, data);
+ * Optional<List<Action>> salActions = convertorManager.convert(ofActions, data);
  * }
  * </pre>
  */
-public final class ActionResponseConvertor implements Convertor<
+public final class ActionResponseConvertor extends Convertor<
         List<Action>,
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>,
         ActionResponseConvertorData> {
@@ -96,7 +96,7 @@ public final class ActionResponseConvertor implements Convertor<
         // Iterate over Openflow actions, run them through tokenizer and then add them to list of converted actions
         if (source != null) {
             for (final Action action : source) {
-                final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> convertedAction = PROCESSOR.process(action.getActionChoice(), data);
+                final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> convertedAction = PROCESSOR.process(action.getActionChoice(), data, getConvertorExecutor());
 
                 if (convertedAction.isPresent()) {
                     result.add(convertedAction.get());
index 9838ffc734f44ea1487d62c6d50ec81d69945c85..28e95b9310e4eb02fe5ea96d944f268628c698a1 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -24,7 +25,7 @@ public class OfToSalCopyTtlInCase extends ConvertorCase<CopyTtlInCase, Action, A
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final CopyTtlInCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final CopyTtlInCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         CopyTtlInBuilder copyTtlInaction = new CopyTtlInBuilder();
         return Optional.of(new CopyTtlInCaseBuilder().setCopyTtlIn(copyTtlInaction.build()).build());
     }
index 369c325e3cb85281ceab244d69d6792eca8185f9..53a75112320d7062c983475d35a1b6b64668189a 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -24,7 +25,7 @@ public class OfToSalCopyTtlOutCase extends ConvertorCase<CopyTtlOutCase, Action,
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final CopyTtlOutCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final CopyTtlOutCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         CopyTtlOutBuilder copyTtlOutaction = new CopyTtlOutBuilder();
         return Optional.of(new CopyTtlOutCaseBuilder().setCopyTtlOut(copyTtlOutaction.build()).build());
     }
index 11eca3074dd8a0940c7d1bbcccf04f8f8a7c11d4..f3ff8f3ee59a1bc9701b73b17dc5554a4fdebcaf 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -24,7 +25,7 @@ public class OfToSalDecMplsTtlCase extends ConvertorCase<DecMplsTtlCase, Action,
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final DecMplsTtlCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final DecMplsTtlCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         DecMplsTtlBuilder decMplsTtl = new DecMplsTtlBuilder();
         return Optional.of(new DecMplsTtlCaseBuilder().setDecMplsTtl(decMplsTtl.build()).build());
     }
index 4305aacba14f153bd577e2120df2d609f1102da6..7a74be06022bdac66eea46bc544d897add89f90c 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -24,7 +25,7 @@ public class OfToSalDecNwTtlCase extends ConvertorCase<DecNwTtlCase, Action, Act
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final DecNwTtlCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final DecNwTtlCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         DecNwTtlBuilder decNwTtl = new DecNwTtlBuilder();
         return Optional.of(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl.build()).build());
     }
index c51cff0cb9cc55a4cae82e00eb13afe07ff8e7cf..ae5067ef49e8e3ca47e3db1e41e7352304f52c24 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -25,7 +26,7 @@ public class OfToSalGroupCase extends ConvertorCase<GroupCase, Action, ActionRes
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final GroupCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final GroupCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         GroupAction groupActionFromOF = source.getGroupAction();
         GroupActionBuilder groupAction = new GroupActionBuilder();
         groupAction.setGroupId(groupActionFromOF.getGroupId());
index 1b831ed407b3f4e8b5a550b363e2868ff52266ed..f24ff5fb01e69544783bd72e7f4d4155f399b2d5 100644 (file)
@@ -12,6 +12,7 @@ import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
@@ -33,7 +34,7 @@ public class OfToSalOutputActionCase extends ConvertorCase<OutputActionCase, Act
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final OutputActionCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final OutputActionCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final OpenflowVersion ofVersion = OpenflowVersion.get(data.getVersion());
 
         OutputActionBuilder outputAction = new OutputActionBuilder();
index 519d06be0c9b7b617391c0a3b3414107285ae9b6..613dcc78979af77be61241f1271b0165a94cefe0 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -25,7 +26,7 @@ public class OfToSalPopMplsCase extends ConvertorCase<PopMplsCase, Action, Actio
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final PopMplsCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final PopMplsCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         PopMplsAction popMplsActionFromOF = source.getPopMplsAction();
         PopMplsActionBuilder popMplsAction = new PopMplsActionBuilder();
         popMplsAction.setEthernetType(popMplsActionFromOF.getEthertype().getValue());
index debc22116fe9f5c60cd0ea995d4e8121507d2520..0867b7724d451043f749e194d9c31a0ec6f355f5 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -24,7 +25,7 @@ public class OfToSalPopPbbCase extends ConvertorCase<PopPbbCase, Action, ActionR
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final PopPbbCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final PopPbbCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         PopPbbActionBuilder popPbb = new PopPbbActionBuilder();
         return Optional.of(new PopPbbActionCaseBuilder().setPopPbbAction(popPbb.build()).build());
     }
index b450bfba323d4e14283ef6cdf58019098c5252fd..b7b5f64d48305b8542730c8226f6a8651a03c02a 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -24,7 +25,7 @@ public class OfToSalPopVlanCase extends ConvertorCase<PopVlanCase, Action, Actio
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final PopVlanCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final PopVlanCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         PopVlanActionBuilder popVlan = new PopVlanActionBuilder();
         return Optional.of(new PopVlanActionCaseBuilder().setPopVlanAction(popVlan.build()).build());
     }
index 4f9c7db1cddebf5329dc87ee815a0ede60e15d14..37217fba3c8ff663b0e1249b768c81f23cec1440 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -25,7 +26,7 @@ public class OfToSalPushMplsCase extends ConvertorCase<PushMplsCase, Action, Act
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final PushMplsCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final PushMplsCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         PushMplsAction pushMplsActionFromOF = source.getPushMplsAction();
         PushMplsActionBuilder pushMplsAction = new PushMplsActionBuilder();
         pushMplsAction.setEthernetType(pushMplsActionFromOF.getEthertype().getValue());
index f2cd9b987daaeb92ad0c3d38231962d502d9d30c..2b09fdb6fe0c04732402cf806d1a761f89093f67 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -25,7 +26,7 @@ public class OfToSalPushPbbCase extends ConvertorCase<PushPbbCase, Action, Actio
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final PushPbbCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final PushPbbCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         PushPbbAction pushPbbActionFromOf = source.getPushPbbAction();
         PushPbbActionBuilder pushPbbAction = new PushPbbActionBuilder();
         pushPbbAction.setEthernetType(pushPbbActionFromOf.getEthertype().getValue());
index 61c8deb7f8e1f00a99be0ce9e41ca4376084a112..c4864e184cf5c72af0994dd2983edbd6800ea0cd 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -25,7 +26,7 @@ public class OfToSalPushVlanCase extends ConvertorCase<PushVlanCase, Action, Act
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final PushVlanCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final PushVlanCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         PushVlanAction pushVlanActionFromOF = source.getPushVlanAction();
         PushVlanActionBuilder pushVlanAction = new PushVlanActionBuilder();
         pushVlanAction.setEthernetType(pushVlanActionFromOF.getEthertype().getValue());
index 3b97a5ca5aed3f4bd1bede9554fb03da91f824dc..3672d3f0302e8af87a1c69ccbd932df875bfeebc 100644 (file)
@@ -11,7 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
@@ -28,11 +28,11 @@ public class OfToSalSetFieldCase extends ConvertorCase<SetFieldCase, Action, Act
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(data.getVersion());
         final SetFieldAction setFieldAction = source.getSetFieldAction();
         final SetFieldBuilder setField = new SetFieldBuilder();
-        final Optional<MatchBuilder> matchOptional = ConvertorManager.getInstance().convert(setFieldAction, datapathIdConvertorData);
+        final Optional<MatchBuilder> matchOptional = convertorExecutor.convert(setFieldAction, datapathIdConvertorData);
         setField.fieldsFrom(matchOptional.orElse(new MatchBuilder()).build());
 
         return Optional.of(new SetFieldCaseBuilder().setSetField(setField.build()).build());
index 8dfc94d437c5d7ecefb4b14e6dc8b59e7466a2ce..ac79d817065b0b3cdfdff478b5637b97877a1a10 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -25,7 +26,7 @@ public class OfToSalSetMplsTtlCase extends ConvertorCase<SetMplsTtlCase, Action,
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final SetMplsTtlCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetMplsTtlCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         SetMplsTtlAction setMplsTtlActionFromOF = source.getSetMplsTtlAction();
 
         SetMplsTtlActionBuilder mplsTtlAction = new SetMplsTtlActionBuilder();
index b87f578dbcd87db984639e01638fa96b86385545..2f7d1710baf795206154a2fd9b311cc8edc0b003 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -24,7 +25,7 @@ public class OfToSalSetNwDstCase extends ConvertorCase<SetNwDstCase, Action, Act
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final SetNwDstCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetNwDstCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
         return Optional.of(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
     }
index 5e207453d38258336186d4c381460e41ee771cbd..07cb4b962ca8cc4e6ae84c3288a7c594ac111f1f 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -25,7 +26,7 @@ public class OfToSalSetNwTtlCase extends ConvertorCase<SetNwTtlCase, Action, Act
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final SetNwTtlCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetNwTtlCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         SetNwTtlAction setNwTtlActionFromOf = source.getSetNwTtlAction();
         SetNwTtlActionBuilder setNwTtl = new SetNwTtlActionBuilder();
         setNwTtl.setNwTtl(setNwTtlActionFromOf.getNwTtl());
index bdaf4784475b718aaeae72d6549660499205b60c..49c9a3e664f6286beebd409fe4e2fc6a4e7ccfd8 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -25,7 +26,7 @@ public class OfToSalSetQueueCase extends ConvertorCase<SetQueueCase, Action, Act
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final SetQueueCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetQueueCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         SetQueueAction queueActionFromOF = source.getSetQueueAction();
         SetQueueActionBuilder setQueueAction = new SetQueueActionBuilder();
         setQueueAction.setQueueId(queueActionFromOF.getQueueId());
index bcc0e7c725c40a63f842a6c6173ea9d5dc8d3c68..c000a980532164dab16b6ab7941d6b3b44b62165 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
@@ -24,7 +25,7 @@ public class OfToSalStripVlanCase extends ConvertorCase<StripVlanCase, Action, A
     }
 
     @Override
-    public Optional<Action> process(@Nonnull final StripVlanCase source, final ActionResponseConvertorData data) {
+    public Optional<Action> process(@Nonnull final StripVlanCase source, final ActionResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         PopVlanActionBuilder popVlan = new PopVlanActionBuilder();
         return Optional.of(new PopVlanActionCaseBuilder().setPopVlanAction(popVlan.build()).build());
     }
index 12d5359f915b4c65f35a4c5a56840e52ce2b1e90..6b51ad78371f8b0345d5d1e4354d5a703d5cf4be 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCase;
@@ -25,7 +26,7 @@ public class SalToOfCopyTtlInCase extends ConvertorCase<CopyTtlInCase, Action, A
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final CopyTtlInCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final CopyTtlInCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         return Optional.of(new ActionBuilder()
                 .setActionChoice(new CopyTtlInCaseBuilder().build())
                 .build());
index cb5b41cfd11e68704ac9d46c2c8c88823c2463c0..76b393738daaffa0f9d58cd387ae8ed6d848425e 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCase;
@@ -25,7 +26,7 @@ public class SalToOfCopyTtlOutCase extends ConvertorCase<CopyTtlOutCase, Action,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final CopyTtlOutCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final CopyTtlOutCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         return Optional.of(new ActionBuilder()
                 .setActionChoice(new CopyTtlOutCaseBuilder().build())
                 .build());
index a5bd2d0531d15b8427dbcce31f258db68209ed0f..8b48009aee55cdcec570bab3c4ff13d83bc442fd 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCase;
@@ -25,7 +26,7 @@ public class SalToOfDecMplsTtlCase extends ConvertorCase<DecMplsTtlCase, Action,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final DecMplsTtlCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final DecMplsTtlCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         return Optional.of(new ActionBuilder()
                 .setActionChoice(new DecMplsTtlCaseBuilder().build())
                 .build());
index 4c8790d30aa8e5ff9d508d4007358cbfffbf21b2..5b2e722c46cc4ef9f0f1ba5065f0e0cd27bdc1cf 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCase;
@@ -25,7 +26,7 @@ public class SalToOfDecNwTtlCase extends ConvertorCase<DecNwTtlCase, Action, Act
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final DecNwTtlCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final DecNwTtlCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         return Optional.of(new ActionBuilder()
                 .setActionChoice(new DecNwTtlCaseBuilder().build())
                 .build());
index a7787c9a3cbd16efdabcf626e82cc8d869a8eef0..104ea4e47175ab86a53d72f0111ba7ea67f139f1 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCase;
@@ -23,7 +24,7 @@ public class SalToOfDropActionCase extends ConvertorCase<DropActionCase, Action,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final DropActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final DropActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         return Optional.empty();
     }
 }
index 04ae198cb5551c3457b4b379ffd22f2a0600f4e9..a36443453497e81b127c5e7dd98c3aca0136ca3f 100644 (file)
@@ -13,6 +13,7 @@ import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
@@ -32,7 +33,7 @@ public class SalToOfGeneralExtensionGroupingCase extends ConvertorCase<GeneralEx
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final GeneralExtensionGrouping source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final GeneralExtensionGrouping source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         final short version = data.getVersion();
         /**
          * TODO: EXTENSION PROPOSAL (action, MD-SAL to OFJava)
index cf2a483dbbb9e6a84db790feed0b6cb25a1900c4..6aed0ccf5916b1c5179ddc32023987362f481811 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;
@@ -27,7 +28,7 @@ public class SalToOfGroupActionCase extends ConvertorCase<GroupActionCase, Actio
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final GroupActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final GroupActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         GroupAction groupAction = source.getGroupAction();
         GroupActionBuilder groupActionBuilder = new GroupActionBuilder();
 
index 644a228bcfe305fd69880e2765c6e65e0c49f1bb..469e82209e8d0024224a68971d29d58fac0ca51f 100644 (file)
@@ -12,6 +12,7 @@ import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
@@ -35,7 +36,7 @@ public class SalToOfOutputActionCase extends ConvertorCase<OutputActionCase, Act
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final OutputActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final OutputActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         final OutputAction outputAction = source.getOutputAction();
         final OutputActionBuilder outputBuilder = new OutputActionBuilder();
 
index 82ba5baf938ece8d77a1f61f85940d5b2a7708af..9c11a412eae9fa7e04bdf7299fb4a3bbe5739b17 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCase;
@@ -27,7 +28,7 @@ public class SalToOfPopMplsActionCase extends ConvertorCase<PopMplsActionCase, A
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final PopMplsActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final PopMplsActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         PopMplsCaseBuilder popMplsCaseBuilder = new PopMplsCaseBuilder();
         PopMplsActionBuilder popMplsBuilder = new PopMplsActionBuilder();
         popMplsBuilder.setEthertype(new EtherType(new EtherType(source.getPopMplsAction().getEthernetType())));
index 8b6a523fe31a07161145b62f290ef419719cb241..8c3fc74989d4085778bf8a450bd515381e453d74 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCase;
@@ -25,7 +26,7 @@ public class SalToOfPopPbbActionCase extends ConvertorCase<PopPbbActionCase, Act
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final PopPbbActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final PopPbbActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         return Optional.of(new ActionBuilder()
                 .setActionChoice(new PopPbbCaseBuilder().build())
                 .build());
index 2025a9949335e40346b7f669e4193d71e60bc59c..ba6c4ba24ce4a231c232e8387b502a7b6037b22c 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCase;
@@ -25,7 +26,7 @@ public class SalToOfPopVlanActionCase extends ConvertorCase<PopVlanActionCase, A
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final PopVlanActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final PopVlanActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         return Optional.of(new ActionBuilder()
                 .setActionChoice(new PopVlanCaseBuilder().build())
                 .build());
index 6319d5ae98b24bcda922cbd90f8c05facb58e43c..6b0fe7a24068faecd83f6f958a9acbfc5da85e90 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCase;
@@ -25,7 +26,7 @@ public class SalToOfPopVlanActionV10Case extends ConvertorCase<PopVlanActionCase
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final PopVlanActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final PopVlanActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         return Optional.of(new ActionBuilder()
                 .setActionChoice(new StripVlanCaseBuilder().build())
                 .build());
index c6e2a529519d6c48ab58bf0b8e1aa3c5b262a89a..d336ed0f6e01bc5e01db275c2f3337ac5391711c 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase;
@@ -27,7 +28,7 @@ public class SalToOfPushMplsActionCase extends ConvertorCase<PushMplsActionCase,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final PushMplsActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final PushMplsActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         PushMplsCaseBuilder pushMplsCaseBuilder = new PushMplsCaseBuilder();
         PushMplsActionBuilder pushMplsBuilder = new PushMplsActionBuilder();
         pushMplsBuilder.setEthertype(new EtherType(source.getPushMplsAction().getEthernetType()));
index b9886c5a300b3c798b8ea7a11a62794def55961d..a9044da966232796e8ab5164e904022a0f77e9de 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase;
@@ -27,7 +28,7 @@ public class SalToOfPushPbbActionCase extends ConvertorCase<PushPbbActionCase, A
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final PushPbbActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final PushPbbActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         PushPbbCaseBuilder pushPbbCaseBuilder = new PushPbbCaseBuilder();
         PushPbbActionBuilder pushPbbBuilder = new PushPbbActionBuilder();
         pushPbbBuilder.setEthertype(new EtherType(source.getPushPbbAction().getEthernetType()));
index a40e94d436b20f871e07923171a1d9028c3756b6..c56416589bd18b0bb95a14036958ea45beb2e3bc 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase;
@@ -28,7 +29,7 @@ public class SalToOfPushVlanActionCase extends ConvertorCase<PushVlanActionCase,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final PushVlanActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final PushVlanActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         PushVlanAction pushVlanAction = source.getPushVlanAction();
 
         PushVlanCaseBuilder pushVlanCaseBuilder = new PushVlanCaseBuilder();
index 36ddbf038906c76f163878d2bb7d96361f362ce4..ada4508dbe3a42be1b640aa463a317cabd42e13e 100644 (file)
@@ -13,6 +13,7 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCase;
@@ -35,7 +36,7 @@ public class SalToOfSetDlDstActionCase extends ConvertorCase<SetDlDstActionCase,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetDlDstActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetDlDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetDlDstAction setdldstaction = source.getSetDlDstAction();
         SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
         SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
index 4b75af97226d6d78aa31aadc7567eb768d0eb373..31e70c66b4f21880ffdc0120a0c85117a191c794 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCase;
@@ -27,7 +28,7 @@ public class SalToOfSetDlDstActionV10Case extends ConvertorCase<SetDlDstActionCa
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetDlDstActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetDlDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetDlDstAction setdldstaction = source.getSetDlDstAction();
         SetDlDstCaseBuilder setDlDstCaseBuilder = new SetDlDstCaseBuilder();
         SetDlDstActionBuilder setDlDstActionBuilder = new SetDlDstActionBuilder();
index 527e0893b200503ba787dc3bddb9653dee0a50b5..736c4b03a5e8e4937d5f88a9c4cf359d8ec2d5ec 100644 (file)
@@ -13,6 +13,7 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCase;
@@ -35,7 +36,7 @@ public class SalToOfSetDlSrcActionCase extends ConvertorCase<SetDlSrcActionCase,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetDlSrcActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetDlSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetDlSrcAction setdlsrcaction = source.getSetDlSrcAction();
         SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
         SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
index b18b42bbfe3e64489f6a07394a21fabe4724e802..f6da183b1888c2eadb9301c2c06584204e574fdd 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCase;
@@ -27,7 +28,7 @@ public class SalToOfSetDlSrcActionV10Case extends ConvertorCase<SetDlSrcActionCa
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetDlSrcActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetDlSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetDlSrcAction setdlsrcaction = source.getSetDlSrcAction();
         SetDlSrcCaseBuilder setDlSrcCaseBuilder = new SetDlSrcCaseBuilder();
         SetDlSrcActionBuilder setDlSrcActionBuilder = new SetDlSrcActionBuilder();
index 858d45895eccd8f356aec612fa008278cebcb0df..a54ecc23bedab8ecd25388ab8f6611404bf2c195 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
@@ -27,11 +28,11 @@ public class SalToOfSetFieldCase extends ConvertorCase<SetFieldCase, Action, Act
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         final short version = data.getVersion();
         final SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
 
-        MatchReactor.getInstance().convert(source.getSetField(), version, setFieldBuilder);
+        MatchReactor.getInstance().convert(source.getSetField(), version, setFieldBuilder, convertorExecutor);
 
         return Optional.of(new ActionBuilder()
                 .setActionChoice(new SetFieldCaseBuilder()
index 510405830cea6e9a8d75a875984f8bc44e6352ae..863e30193db115be527171df22fd73f43c984cec 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase;
@@ -26,7 +27,7 @@ public class SalToOfSetFieldV10Case extends ConvertorCase<SetFieldCase, Action,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetVlanVidCaseBuilder setVlanVidCaseBuilder = new SetVlanVidCaseBuilder();
 
         if (source.getSetField().getVlanMatch() != null) {
index 516388924e7af2f904b30052301780ea7d2f070b..957bf38459bb3a3d3c39e60b9e9649f6049d685b 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCase;
@@ -26,7 +27,7 @@ public class SalToOfSetMplsTtlActionCase extends ConvertorCase<SetMplsTtlActionC
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetMplsTtlActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetMplsTtlActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetMplsTtlActionBuilder setMplsTtlBuilder = new SetMplsTtlActionBuilder()
                 .setMplsTtl(source.getSetMplsTtlAction().getMplsTtl());
 
index 2dcba511035d02ebd463b814c37da696e39bcfe4..d9d58185fc54e944fc2ec8c514f6d81236224422 100644 (file)
@@ -14,6 +14,7 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
@@ -46,7 +47,7 @@ public class SalToOfSetNwDstActionCase extends ConvertorCase<SetNwDstActionCase,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetNwDstActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetNwDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         final ActionBuilder builder = new ActionBuilder();
         final Address address = source.getSetNwDstAction().getAddress();
 
index a33f8b6f8b5acdc550305862e124e6f0a1cb5a1e..d55fd78a2dd7b9dafefdf2c498e0b2ed0e51fa06 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
@@ -29,7 +30,7 @@ public class SalToOfSetNwDstActionV10Case extends ConvertorCase<SetNwDstActionCa
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetNwDstActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetNwDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         final ActionBuilder builder = new ActionBuilder();
         final Address address = source.getSetNwDstAction().getAddress();
 
index d326e592b57bb2ac9bd3e8408399c94350f2a127..2fb9f94923cbc240c81049d62a8f0a349e1f8039 100644 (file)
@@ -14,6 +14,7 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
@@ -46,7 +47,7 @@ public class SalToOfSetNwSrcActionCase extends ConvertorCase<SetNwSrcActionCase,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetNwSrcActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetNwSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         final ActionBuilder builder = new ActionBuilder();
         final Address address = source.getSetNwSrcAction().getAddress();
 
index a4523dfad413bbcc74588b35c0016f3a7f3bfe52..006a5cd01d998fba64096d92fa067bc857cb2932 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
@@ -29,7 +30,7 @@ public class SalToOfSetNwSrcActionV10Case extends ConvertorCase<SetNwSrcActionCa
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetNwSrcActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetNwSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         final ActionBuilder builder = new ActionBuilder();
         final Address address = source.getSetNwSrcAction().getAddress();
 
index 02f2e0a33b75a2dba22694405501dde0f907ba15..3ffdd008389dee25b3810faceb1291c2db46fd40 100644 (file)
@@ -13,6 +13,7 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorUtil;
@@ -33,7 +34,7 @@ public class SalToOfSetNwTosActionCase extends ConvertorCase<SetNwTosActionCase,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetNwTosActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetNwTosActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetNwTosAction setnwtosaction = source.getSetNwTosAction();
         SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
         SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
index 21b7a3e9a8e66f0b4728e6f4629ff49c77efcf1e..80e67fcd4e73cd4e35ff12c4892b2888f37af6e6 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCase;
@@ -27,7 +28,7 @@ public class SalToOfSetNwTosActionV10Case extends ConvertorCase<SetNwTosActionCa
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetNwTosActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetNwTosActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetNwTosAction setnwtosaction = source.getSetNwTosAction();
         SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
         SetNwTosCaseBuilder setNwTosCaseBuilder = new SetNwTosCaseBuilder();
index 3a51f5e367bf27e4a435a441cd447c1671c3c4bf..1d5d5610a1e356da337162b7ccaf2d77ef03fd2f 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCase;
@@ -26,7 +27,7 @@ public class SalToOfSetNwTtlActionCase extends ConvertorCase<SetNwTtlActionCase,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetNwTtlActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetNwTtlActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetNwTtlCaseBuilder nwTtlCaseBuilder = new SetNwTtlCaseBuilder();
         SetNwTtlActionBuilder nwTtlBuilder = new SetNwTtlActionBuilder();
         nwTtlBuilder.setNwTtl(source.getSetNwTtlAction().getNwTtl());
index a9db724f919093e1878811286f5b1296c521c20b..b433bc844110705714fe2efd34e3e055d2e74e62 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCase;
@@ -27,7 +28,7 @@ public class SalToOfSetQueueActionCase extends ConvertorCase<SetQueueActionCase,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetQueueActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetQueueActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetQueueAction setQueueAction = source.getSetQueueAction();
         SetQueueCaseBuilder setQueueCaseBuilder = new SetQueueCaseBuilder();
         SetQueueActionBuilder setQueueBuilder = new SetQueueActionBuilder();
index 1995ebe75c776ba0d9865058e97989a449fec07e..81027bfb20c4821af0dcecdb56ea82894ed85648 100644 (file)
@@ -13,6 +13,7 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IPProtocols;
@@ -49,7 +50,7 @@ public class SalToOfSetTpDstActionCase extends ConvertorCase<SetTpDstActionCase,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetTpDstActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetTpDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         IPProtocols protocol = null;
 
         if (data.getIpProtocol() != null) {
index e762a0433c7c7021989d892b2293321a25aef58b..d870f1ea1bccd2c46cf3cb4aa74e444200187010 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCase;
@@ -28,7 +29,7 @@ public class SalToOfSetTpDstActionV10Case extends ConvertorCase<SetTpDstActionCa
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetTpDstActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetTpDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetTpDstAction settpdstaction = source.getSetTpDstAction();
         SetTpDstCaseBuilder setTpDstCaseBuilder = new SetTpDstCaseBuilder();
         SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
index 641df7d3db4794f0f8ff81c1da1271d2ceb7c624..3844dd0cf0856a515b4639027c6d5d7b45d9bdfe 100644 (file)
@@ -13,6 +13,7 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IPProtocols;
@@ -49,7 +50,7 @@ public class SalToOfSetTpSrcActionCase extends ConvertorCase<SetTpSrcActionCase,
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetTpSrcActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetTpSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         IPProtocols protocol = null;
 
         if (data.getIpProtocol() != null) {
index 2b455c8449a542b0694ad9be973dcb4622fbda25..c60cfccc372226abe4158d1715cac6ef610f3459 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCase;
@@ -32,7 +33,7 @@ public class SalToOfSetTpSrcActionV10Case extends ConvertorCase<SetTpSrcActionCa
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetTpSrcActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetTpSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetTpSrcAction settpsrcaction = source.getSetTpSrcAction();
         SetTpSrcCaseBuilder setTpSrcCaseBuilder = new SetTpSrcCaseBuilder();
         SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
index 3722293f56de900fba7e648f347cd8381cda39ec..9bd386ca897e4fb71327ed819f1b8da3673cb053 100644 (file)
@@ -13,6 +13,7 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase;
@@ -35,7 +36,7 @@ public class SalToOfSetVlanIdActionCase extends ConvertorCase<SetVlanIdActionCas
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetVlanIdActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetVlanIdActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetVlanIdAction setvlanidaction = source.getSetVlanIdAction();
         SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
         SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
index 0f2543b4afb68b2c8e83cea93c54a6ac5ac287cb..2ace31627eb1fb47f61eb31df8ee8b2b518826d2 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase;
@@ -27,7 +28,7 @@ public class SalToOfSetVlanIdActionV10Case extends ConvertorCase<SetVlanIdAction
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetVlanIdActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetVlanIdActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetVlanIdAction setvlanidaction = source.getSetVlanIdAction();
         SetVlanVidActionBuilder vlanidActionBuilder = new SetVlanVidActionBuilder();
         SetVlanVidCaseBuilder setVlanVidCaseBuilder = new SetVlanVidCaseBuilder();
index 798f6ebbc7f1e197f7a3aa1488282a7fa1d1f153..7ef7221f803da5b1aa7f18e2c83097f02ea9bf33 100644 (file)
@@ -13,6 +13,7 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorUtil;
@@ -31,7 +32,7 @@ public class SalToOfSetVlanPcpActionCase extends ConvertorCase<SetVlanPcpActionC
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetVlanPcpActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetVlanPcpActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetVlanPcpAction setvlanpcpaction = source.getSetVlanPcpAction();
         SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
         SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
index 6c2babb89d65ea2c3b718baabcca29b415d03337..f6f436cb88010a5c4faa193d04a7307ed1a7aea5 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCase;
@@ -27,7 +28,7 @@ public class SalToOfSetVlanPcpActionV10Case extends ConvertorCase<SetVlanPcpActi
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final SetVlanPcpActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final SetVlanPcpActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetVlanPcpAction setvlanpcpaction = source.getSetVlanPcpAction();
         SetVlanPcpActionBuilder setVlanPcpActionBuilder = new SetVlanPcpActionBuilder();
         SetVlanPcpCaseBuilder setVlanPcpCaseBuilder = new SetVlanPcpCaseBuilder();
index 30ccb2e35c9bebb574ac6b969a4a137639075b05..8b595adc5bb150d802a278cc30e834e9fae5109d 100644 (file)
@@ -13,6 +13,7 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCase;
@@ -34,7 +35,7 @@ public class SalToOfStripVlanActionCase extends ConvertorCase<StripVlanActionCas
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final StripVlanActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final StripVlanActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
         SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
         List<MatchEntry> entries = new ArrayList<>();
index 026efbfe6899f69c0de31f7b8e042029995bafce..aff535a02e650e2befc18d49b7d617e057997754 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ca
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCase;
@@ -25,7 +26,7 @@ public class SalToOfStripVlanActionV10Case extends ConvertorCase<StripVlanAction
 
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final StripVlanActionCase source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final StripVlanActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         return Optional.of(new ActionBuilder()
                 .setActionChoice(new StripVlanCaseBuilder().build())
                 .build());
index 81d68e3ceb9bd31b8375f66a3fbd652bc6829ebc..25e450e992cc52fd6e4405bf4ec82a0898d221c9 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava;
 import org.opendaylight.openflowplugin.extension.api.TypeVersionKey;
 import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
@@ -31,7 +32,7 @@ public class SalToOfVendorCodecCase extends ConvertorCase<org.opendaylight.yang.
     @SuppressWarnings("unchecked")
     @Nonnull
     @Override
-    public Optional<Action> process(@Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action source, final ActionConvertorData data) {
+    public Optional<Action> process(@Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         final short version = data.getVersion();
         final TypeVersionKey<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> key =
                 new TypeVersionKey<>(
index 0ff50e7c24750a4a80cc0accea1849a8c72a898a..ede61108a35f3c9357360ded213e6a6afc9c0695 100644 (file)
@@ -11,18 +11,19 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common;
 import com.google.common.collect.ImmutableMap;
 import java.util.HashMap;
 import java.util.Map;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 
 /**
  * @param <FROM> source type for conversion
  *
  */
 public abstract class ConvertReactor<FROM> {
-    private final Map<InjectionKey, ResultInjector<?, ?>> injectionMapping;
-    private final Map<Short, Convertor<FROM, ?, ?>> conversionMapping;
+    private final Map<ConvertorKey, ResultInjector<?, ?>> injectionMapping;
+    private final Map<Short, ConvertReactorConvertor<FROM, ?>> conversionMapping;
 
     protected ConvertReactor() {
-        final Map<Short, Convertor<FROM, ?, ?>> conversions = new HashMap<>();
-        final Map<InjectionKey, ResultInjector<?, ?>> injections = new HashMap<>();
+        final Map<Short, ConvertReactorConvertor<FROM, ?>> conversions = new HashMap<>();
+        final Map<ConvertorKey, ResultInjector<?, ?>> injections = new HashMap<>();
         initMappings(conversions, injections);
 
         // Create optimized view of mappings
@@ -35,28 +36,29 @@ public abstract class ConvertReactor<FROM> {
      * @param conversions convert from
      * @param injections injection
      */
-    protected abstract void initMappings(Map<Short, Convertor<FROM, ?, ?>> conversions,
-            Map<InjectionKey, ResultInjector<?, ?>> injections);
+    protected abstract void initMappings(Map<Short, ConvertReactorConvertor<FROM, ?>> conversions,
+            Map<ConvertorKey, ResultInjector<?, ?>> injections);
 
     /**
+     * @param <RESULT> result
+     * @param <TARGET> target
      * @param source convert from
      * @param version openflow version
      * @param target convert to
-     * @param <RESULT> result
-     * @param <TARGET> target
+     * @param convertorExecutor
      */
     @SuppressWarnings("unchecked")
-    public <RESULT, TARGET> void convert(final FROM source, final short version, final TARGET target) {
+    public <RESULT, TARGET> void convert(final FROM source, final short version, final TARGET target, final ConvertorExecutor convertorExecutor) {
 
         //lookup converter
-        Convertor<FROM, RESULT, ?> convertor = (Convertor<FROM, RESULT, ?>) conversionMapping.get(version);
+        ConvertReactorConvertor<FROM, RESULT> convertor = (ConvertReactorConvertor<FROM, RESULT>) conversionMapping.get(version);
         if (convertor == null) {
             throw new IllegalArgumentException("convertor for given version ["+version+"] not found");
         }
-        RESULT convertedItem = convertor.convert(source, null);
+        RESULT convertedItem = convertor.convert(source, convertorExecutor);
 
         //lookup injection
-        InjectionKey key = buildInjectionKey(version, convertedItem, target);
+        ConvertorKey key = buildInjectionKey(version, convertedItem, target);
         ResultInjector<RESULT, TARGET> injection = (ResultInjector<RESULT, TARGET>) injectionMapping.get(key);
         if (injection == null) {
             throw new IllegalArgumentException("injector for given version and target ["+key+"] not found");
@@ -70,8 +72,8 @@ public abstract class ConvertReactor<FROM> {
      * @param target object
      * @return injection key
      */
-    protected InjectionKey buildInjectionKey(final short version, final Object convertedItem, final Object target) {
-        return new InjectionKey(version, target.getClass());
+    protected ConvertorKey buildInjectionKey(final short version, final Object convertedItem, final Object target) {
+        return new ConvertorKey(version, target.getClass());
     }
 
 }
diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/common/ConvertReactorConvertor.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/common/ConvertReactorConvertor.java
new file mode 100644 (file)
index 0000000..938f975
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common;
+
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+
+/**
+ * Converts OpenflowJava to MDSal model and vice versa
+ *
+ * @param <FROM> type of source
+ * @param <TO>   type of result
+ */
+public interface ConvertReactorConvertor<FROM, TO> {
+    /**
+     * Converts source to result
+     *
+     * @param source source
+     * @param convertorExecutor
+     * @return converted source
+     */
+    TO convert(FROM source, ConvertorExecutor convertorExecutor);
+}
index cb52a506d3ebef35cd56d78f1f05a6ce11b97ded..91f91d2aac3c19c559aac2a4b6044594cc7c8562 100644 (file)
@@ -9,7 +9,7 @@
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common;
 
 import java.util.Collection;
-import javax.annotation.Nullable;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 /**
@@ -17,8 +17,28 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  *
  * @param <FROM> type of source
  * @param <TO>   type of result
+ * @param <DATA> the type parameter
  */
-public interface Convertor<FROM, TO, DATA extends ConvertorData> {
+public abstract class Convertor<FROM, TO, DATA extends ConvertorData> {
+    private ConvertorExecutor convertorExecutor;
+
+    /**
+     * Gets convertor manager.
+     *
+     * @return the convertor manager
+     */
+    protected ConvertorExecutor getConvertorExecutor() {
+        return convertorExecutor;
+    }
+
+    /**
+     * Sets convertor manager.
+     *
+     * @param convertorExecutor the convertor manager
+     */
+    public void setConvertorExecutor(ConvertorExecutor convertorExecutor) {
+        this.convertorExecutor = convertorExecutor;
+    }
 
     /**
      * Gets type of convertor, used in
@@ -26,7 +46,7 @@ public interface Convertor<FROM, TO, DATA extends ConvertorData> {
      *
      * @return the type of convertor
      */
-    Collection<Class<? extends DataContainer>> getTypes();
+    public abstract Collection<Class<? extends DataContainer>> getTypes();
 
     /**
      * Converts source to result
@@ -35,5 +55,5 @@ public interface Convertor<FROM, TO, DATA extends ConvertorData> {
      * @param data   convertor data
      * @return converted source
      */
-    TO convert(FROM source, @Nullable DATA data);
+    public abstract TO convert(FROM source, DATA data);
 }
index aa9ea1f96e700e22a1ee1f7eaf56f2912699e178..c1639d0bb514745850dd765d0915798a4c656e8d 100644 (file)
@@ -13,6 +13,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 
 /**
  * The Convertor case used in {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorProcessor}.
@@ -42,11 +43,13 @@ public abstract class ConvertorCase<FROM, TO, DATA extends ConvertorData> {
     /**
      * Process source and return result, what can be empty
      *
+     *
      * @param source the source
      * @param data   the data
+     * @param convertorExecutor convertor executor
      * @return the optional
      */
-    public abstract Optional<TO> process(@Nonnull final FROM source, final DATA data);
+    public abstract Optional<TO> process(@Nonnull final FROM source, final DATA data, final ConvertorExecutor convertorExecutor);
 
     /**
      * Should {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorProcessor}
@@ -61,12 +64,14 @@ public abstract class ConvertorCase<FROM, TO, DATA extends ConvertorData> {
     /**
      * Cast untyped source to type of this case and sends it to actual process method.
      *
+     *
      * @param source the source
      * @param data   the data
+     * @param convertorExecutor convertor executor
      * @return the optional
      */
-    Optional<TO> processRaw(@Nonnull final Object source, final DATA data) {
-        return process(getType().cast(source), data);
+    Optional<TO> processRaw(@Nonnull final Object source, final DATA data, final ConvertorExecutor convertorExecutor) {
+        return process(getType().cast(source), data, convertorExecutor);
     }
 
     /**
@@ -16,7 +16,7 @@ import com.google.common.base.Preconditions;
 /**
  * injection lookup key based on version and target object
  */
-public class InjectionKey {
+public class ConvertorKey {
 
     private final int version;
     private final Class<?> targetClazz;
@@ -25,7 +25,7 @@ public class InjectionKey {
      * @param version openflow version
      * @param targetClazz target class
      */
-    public InjectionKey(final int version, final Class<?> targetClazz) {
+    public ConvertorKey(final int version, final Class<?> targetClazz) {
         this.version = version;
         this.targetClazz = Preconditions.checkNotNull(targetClazz);
     }
@@ -46,11 +46,8 @@ public class InjectionKey {
         if (getClass() != obj.getClass()) {
             return false;
         }
-        final InjectionKey other = (InjectionKey) obj;
-        if (version != other.version) {
-            return false;
-        }
-        return targetClazz.equals(other.targetClazz);
+        final ConvertorKey other = (ConvertorKey) obj;
+        return version == other.version && targetClazz.equals(other.targetClazz);
     }
 
     @Override
index acb8347beb6fb4444231a2bb7adbe2e89f3ecea0..c06629a225f509135607b579e7876ce33c45ae25 100644 (file)
@@ -12,6 +12,7 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -27,7 +28,7 @@ public class ConvertorProcessor<FROM extends DataContainer, TO, DATA extends Con
     private static final short OFP_VERSION_ALL = 0x00;
     private static final Logger LOG = LoggerFactory.getLogger(ConvertorProcessor.class);
 
-    private final Map<InjectionKey, ConvertorCase<?, TO, DATA>> conversions = new ConcurrentHashMap<>();
+    private final Map<Short, Map<Class<?>, ConvertorCase<?, TO, DATA>>> conversions = new ConcurrentHashMap<>();
     private ConvertorCase<?, TO, DATA> defaultCase;
 
     /**
@@ -38,12 +39,10 @@ public class ConvertorProcessor<FROM extends DataContainer, TO, DATA extends Con
      */
     public ConvertorProcessor<FROM, TO, DATA> addCase(final ConvertorCase<?, TO, DATA> processorCase) {
         if (processorCase.getSupportedVersions().isEmpty()) {
-            final InjectionKey key = new InjectionKey(OFP_VERSION_ALL, processorCase.getType());
-            conversions.putIfAbsent(key, processorCase);
+            getCasesForVersion(OFP_VERSION_ALL).putIfAbsent(processorCase.getType(), processorCase);
         } else {
             for (short supportedVersion : processorCase.getSupportedVersions()) {
-                final InjectionKey key = new InjectionKey(supportedVersion, processorCase.getType());
-                conversions.putIfAbsent(key, processorCase);
+                getCasesForVersion(supportedVersion).putIfAbsent(processorCase.getType(), processorCase);
             }
         }
 
@@ -54,10 +53,11 @@ public class ConvertorProcessor<FROM extends DataContainer, TO, DATA extends Con
      * Process source and return result based on convertor cases, or empty if no match is found.
      *
      * @param source the source
+     * @param convertorExecutor convertor executor
      * @return the optional
      */
-    public Optional<TO> process(final FROM source) {
-        return process(source, null);
+    public Optional<TO> process(final FROM source, final ConvertorExecutor convertorExecutor) {
+        return process(source, null, convertorExecutor);
     }
 
     /**
@@ -65,9 +65,10 @@ public class ConvertorProcessor<FROM extends DataContainer, TO, DATA extends Con
      *
      * @param source the source
      * @param data   the data
+     * @param convertorExecutor convertor executor
      * @return the optional
      */
-    public Optional<TO> process(final FROM source, final DATA data) {
+    public Optional<TO> process(final FROM source, final DATA data, final ConvertorExecutor convertorExecutor) {
         Optional<TO> result = Optional.empty();
         final short version = data != null ? data.getVersion() : OFP_VERSION_ALL;
 
@@ -77,12 +78,13 @@ public class ConvertorProcessor<FROM extends DataContainer, TO, DATA extends Con
         }
 
         final Class<?> clazz = source.getImplementedInterface();
-        final InjectionKey key = new InjectionKey(version, clazz);
-        final Optional<ConvertorCase<?, TO, DATA>> caseOptional = Optional.ofNullable(conversions.get(key));
+        final Optional<ConvertorCase<?, TO, DATA>> caseOptional = Optional
+                .ofNullable(getCasesForVersion(version).get(clazz));
+
         final ConvertorCase<?, TO, DATA> processorCase = caseOptional.orElse(defaultCase);
 
         if (Objects.nonNull(processorCase)) {
-            result = processorCase.processRaw(source, data);
+            result = processorCase.processRaw(source, data, convertorExecutor);
 
             if (processorCase.isErrorOnEmpty() && !result.isPresent()) {
                 LOG.warn("Failed to process {} for version {}", clazz, version);
@@ -104,4 +106,13 @@ public class ConvertorProcessor<FROM extends DataContainer, TO, DATA extends Con
         this.defaultCase = defaultCase;
         return this;
     }
+
+    private Map<Class<?>, ConvertorCase<?, TO, DATA>> getCasesForVersion(final short version) {
+        final Map<Class<?>, ConvertorCase<?, TO, DATA>> casesForVersion =
+                conversions.getOrDefault(version, new ConcurrentHashMap<>());
+
+        conversions.putIfAbsent(version, casesForVersion);
+
+        return casesForVersion;
+    }
 }
index f3059e6039de8441d7cc250285b1b08ac670af59..d44545113494e4821c6ac350ab0a9e6a4ec6f02f 100644 (file)
@@ -9,12 +9,11 @@
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data;
 
 import java.math.BigInteger;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData;
 
 /**
  * Convertor data implementation containing Openflow version and datapath ID
  */
-public class VersionDatapathIdConvertorData extends ConvertorData {
+public class VersionDatapathIdConvertorData extends VersionConvertorData {
     private BigInteger datapathId;
 
     /**
index 079827dfc8c5244387bd28d118cb9ec72db2e44e..47a8a3f0111b9475169f999c0cdc1bd1f9aaeec5 100644 (file)
@@ -19,7 +19,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorProcessor;
@@ -77,11 +76,11 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  * {@code
  * VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
  * data.setDatapathId(datapathId);
- * Optional<List<FlowModInputBuilder>> ofFlow = ConvertorManager.getInstance().convert(salFlow, data);
+ * Optional<List<FlowModInputBuilder>> ofFlow = convertorManager.convert(salFlow, data);
  * }
  * </pre>
  */
-public class FlowConvertor implements Convertor<Flow, List<FlowModInputBuilder>, VersionDatapathIdConvertorData> {
+public class FlowConvertor extends Convertor<Flow, List<FlowModInputBuilder>, VersionDatapathIdConvertorData> {
     /**
      * Default idle timeout
      */
@@ -145,6 +144,7 @@ public class FlowConvertor implements Convertor<Flow, List<FlowModInputBuilder>,
             .addCase(new MeterCase())
             .addCase(new WriteActionsCase())
             .addCase(new WriteMetadataCase());
+    private static final List<Class<? extends DataContainer>> TYPES = Arrays.asList(Flow.class, AddFlowInput.class, RemoveFlowInput.class, UpdatedFlow.class);
 
     static {
         final VlanId zeroVlan = new VlanId(0);
@@ -165,7 +165,7 @@ public class FlowConvertor implements Convertor<Flow, List<FlowModInputBuilder>,
         VLAN_MATCH_TRUE = vlanMatchBuilder2.build();
     }
 
-    private static FlowModInputBuilder toFlowModInput(Flow flow, short version, BigInteger datapathid) {
+    private FlowModInputBuilder toFlowModInput(Flow flow, short version, BigInteger datapathid) {
 
         FlowModInputBuilder flowMod = new FlowModInputBuilder();
         salToOFFlowCookie(flow, flowMod);
@@ -180,10 +180,10 @@ public class FlowConvertor implements Convertor<Flow, List<FlowModInputBuilder>,
         salToOFFlowOutGroup(flow, flowMod);
 
         // convert and inject flowFlags
-        FlowFlagReactor.getInstance().convert(flow.getFlags(), version, flowMod);
+        FlowFlagReactor.getInstance().convert(flow.getFlags(), version, flowMod, getConvertorExecutor());
 
         // convert and inject match
-        MatchReactor.getInstance().convert(flow.getMatch(), version, flowMod);
+        MatchReactor.getInstance().convert(flow.getMatch(), version, flowMod, getConvertorExecutor());
 
         if (flow.getInstructions() != null) {
             flowMod.setInstruction(toInstructions(flow, version, datapathid));
@@ -279,7 +279,7 @@ public class FlowConvertor implements Convertor<Flow, List<FlowModInputBuilder>,
         }
     }
 
-    private static List<Instruction> toInstructions(Flow flow, short version, BigInteger datapathid) {
+    private List<Instruction> toInstructions(Flow flow, short version, BigInteger datapathid) {
         final List<Instruction> instructionsList = new ArrayList<>();
         final ActionConvertorData data = new ActionConvertorData(version);
         data.setDatapathId(datapathid);
@@ -292,7 +292,7 @@ public class FlowConvertor implements Convertor<Flow, List<FlowModInputBuilder>,
             org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction curInstruction = instruction
                     .getInstruction();
 
-            Optional<Instruction> result = PROCESSOR.process(curInstruction, data);
+            Optional<Instruction> result = PROCESSOR.process(curInstruction, data, getConvertorExecutor());
 
             if (result.isPresent()) {
                 instructionsList.add(result.get());
@@ -302,7 +302,7 @@ public class FlowConvertor implements Convertor<Flow, List<FlowModInputBuilder>,
         return instructionsList;
     }
 
-    private static List<Action> getActions(short version, BigInteger datapathid, Flow flow) {
+    private List<Action> getActions(short version, BigInteger datapathid, 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());
@@ -318,7 +318,7 @@ public class FlowConvertor implements Convertor<Flow, List<FlowModInputBuilder>,
                 final ActionConvertorData data = new ActionConvertorData(version);
                 data.setDatapathId(datapathid);
                 data.setIpProtocol(FlowConvertorUtil.getIpProtocolFromFlow(flow));
-                Optional<List<Action>> result = ConvertorManager.getInstance().convert(applyActions.getAction(), data);
+                Optional<List<Action>> result = getConvertorExecutor().convert(applyActions.getAction(), data);
                 return result.orElse(Collections.emptyList());
             }
         }
@@ -361,7 +361,7 @@ public class FlowConvertor implements Convertor<Flow, List<FlowModInputBuilder>,
      * Â  Â  1) Match on (OFPVID_NONE ) without mask + action [push vlan tag + set_field]
      * Â  Â  2) Match on (OFPVID_PRESENT) with mask (OFPVID_PRESENT ) + action [ set_field]
      */
-    private static List<FlowModInputBuilder> handleSetVlanIdForOF13(Flow srcFlow, short version, BigInteger datapathId) {
+    private List<FlowModInputBuilder> handleSetVlanIdForOF13(Flow srcFlow, short version, BigInteger datapathId) {
         List<FlowModInputBuilder> list = new ArrayList<>(2);
 
         final Match srcMatch = Preconditions.checkNotNull(srcFlow.getMatch());
@@ -515,7 +515,7 @@ public class FlowConvertor implements Convertor<Flow, List<FlowModInputBuilder>,
 
     @Override
     public Collection<Class<? extends DataContainer>> getTypes() {
-        return Arrays.asList(Flow.class, AddFlowInput.class, RemoveFlowInput.class, UpdatedFlow.class);
+        return  TYPES;
     }
 
     @Override
index a72713476f281f5f462f9d1aaf18d6f74b4bf83a..edc10de00bf5838ec8cc33c541405b24f44245e0 100644 (file)
@@ -17,7 +17,6 @@ import java.util.Optional;
 import java.util.Set;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
@@ -52,11 +51,11 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  * <pre>
  * {@code
  * VersionConvertorData data = new VersionConvertorData(version);
- * Optional<Instructions> salFlowInstruction = ConvertorManager.getInstance().convert(ofFlowInstructions, data);
+ * Optional<Instructions> salFlowInstruction = convertorManager.convert(ofFlowInstructions, data);
  * }
  * </pre>
  */
-public final class FlowInstructionResponseConvertor implements Convertor<
+public final class FlowInstructionResponseConvertor extends Convertor<
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction>,
         Instructions,
         VersionConvertorData> {
@@ -86,7 +85,7 @@ public final class FlowInstructionResponseConvertor implements Convertor<
                 final ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(data.getVersion());
                 actionResponseConvertorData.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
 
-                final Optional<List<Action>> actions = ConvertorManager.getInstance().convert(
+                final Optional<List<Action>> actions = getConvertorExecutor().convert(
                         actionsInstruction.getApplyActions().getAction(), actionResponseConvertorData);
 
                 applyActionsBuilder.setAction(FlowConvertorUtil.wrapActionList(actions.orElse(Collections.emptyList())));
@@ -121,7 +120,7 @@ public final class FlowInstructionResponseConvertor implements Convertor<
                 final ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(data.getVersion());
                 actionResponseConvertorData.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
 
-                final Optional<List<Action>> actions = ConvertorManager.getInstance().convert(
+                final Optional<List<Action>> actions = getConvertorExecutor().convert(
                         writeActionsCase.getWriteActions().getAction(), actionResponseConvertorData);
 
                 writeActionsBuilder.setAction(FlowConvertorUtil.wrapActionList(actions.orElse(Collections.emptyList())));
index 19f25de81e42dfb449c92a9024feec0ececa38d9..84c8b69e2a51821c5e7d66f43b495d295563c250 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow;
 
-import com.google.common.annotations.VisibleForTesting;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -20,7 +19,6 @@ import org.opendaylight.openflowplugin.extension.api.AugmentTuple;
 import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
 import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
 import org.opendaylight.openflowplugin.openflow.md.core.extension.MatchExtensionHelper;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
@@ -52,11 +50,11 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  * {@code
  * VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
  * data.setDatapathId(datapathId);
- * Optional<List<FlowAndStatisticsMapList>> salFlowStats = ConvertorManager.getInstance().convert(ofFlowStats, data);
+ * Optional<List<FlowAndStatisticsMapList>> salFlowStats = convertorManager.convert(ofFlowStats, data);
  * }
  * </pre>
  */
-public class FlowStatsResponseConvertor implements Convertor<List<FlowStats>, List<FlowAndStatisticsMapList>, VersionDatapathIdConvertorData> {
+public class FlowStatsResponseConvertor extends Convertor<List<FlowStats>, List<FlowAndStatisticsMapList>, VersionDatapathIdConvertorData> {
 
     private static final Set<Class<? extends DataContainer>> TYPES = Collections.singleton(FlowStats.class);
 
@@ -66,8 +64,7 @@ public class FlowStatsResponseConvertor implements Convertor<List<FlowStats>, Li
      * @param actionsList list of action
      * @return OF10 actions as an instructions
      */
-    @VisibleForTesting
-    static Instructions wrapOF10ActionsToInstruction(List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actionsList, final short version) {
+    private Instructions wrapOF10ActionsToInstruction(List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actionsList, final short version) {
         ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(version);
         actionResponseConvertorData.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
 
@@ -77,7 +74,7 @@ public class FlowStatsResponseConvertor implements Convertor<List<FlowStats>, Li
         ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
         ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
 
-        final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>> actions = ConvertorManager.getInstance().convert(
+        final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>> actions = getConvertorExecutor().convert(
                 actionsList, actionResponseConvertorData);
 
         applyActionsBuilder.setAction(FlowConvertorUtil.wrapActionList(actions.orElse(Collections.emptyList())));
@@ -123,7 +120,7 @@ public class FlowStatsResponseConvertor implements Convertor<List<FlowStats>, Li
             salFlowStatsBuilder.setTableId(flowStats.getTableId());
 
             if (flowStats.getMatchV10() != null) {
-                final Optional<MatchBuilder> matchBuilderOptional = ConvertorManager.getInstance().convert(flowStats.getMatchV10(), data);
+                final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(flowStats.getMatchV10(), data);
 
                 if (matchBuilderOptional.isPresent()) {
                     salFlowStatsBuilder.setMatch(matchBuilderOptional.get().build());
@@ -135,7 +132,7 @@ public class FlowStatsResponseConvertor implements Convertor<List<FlowStats>, Li
             }
 
             if (flowStats.getMatch() != null) {
-                final Optional<MatchBuilder> matchBuilderOptional = ConvertorManager.getInstance().convert(flowStats.getMatch(), data);
+                final Optional<MatchBuilder> matchBuilderOptional = getConvertorExecutor().convert(flowStats.getMatch(), data);
 
                 if (matchBuilderOptional.isPresent()) {
                     final MatchBuilder matchBuilder = matchBuilderOptional.get();
@@ -164,7 +161,7 @@ public class FlowStatsResponseConvertor implements Convertor<List<FlowStats>, Li
 
             if (flowStats.getInstruction() != null) {
                 final VersionConvertorData simpleConvertorData = new VersionConvertorData(data.getVersion());
-                final Optional<Instructions> instructions = ConvertorManager.getInstance().convert(
+                final Optional<Instructions> instructions = getConvertorExecutor().convert(
                         flowStats.getInstruction(), simpleConvertorData);
 
                 salFlowStatsBuilder.setInstructions(instructions.orElse(new InstructionsBuilder()
index 2ed5d56d950482bf07ea9e93298e2ec92469b57c..139cd8cc47291a4d3137289f1f077be2ee7dc54f 100644 (file)
@@ -13,7 +13,7 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActions;
@@ -29,13 +29,12 @@ public class ApplyActionsCase extends ConvertorCase<org.opendaylight.yang.gen.v1
     }
 
     @Override
-    public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase source, final ActionConvertorData data) {
+    public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         ApplyActions applyActions = source.getApplyActions();
         ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
         ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
 
-        final Optional<List<Action>> actionList = ConvertorManager.getInstance().convert(
-                applyActions.getAction(), data);
+        final Optional<List<Action>> actionList = convertorExecutor.convert(applyActions.getAction(), data);
 
         applyActionsBuilder.setAction(actionList.orElse(Collections.emptyList()));
         applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build());
index 0aa8bd610a1f6ec339de9a6894eddd7dcceba316..c167ceffaa76369886041bbc0060a6ce0188d3c5 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.case
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCaseBuilder;
@@ -23,7 +24,7 @@ public class ClearActionsCase extends ConvertorCase<org.opendaylight.yang.gen.v1
     }
 
     @Override
-    public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCase source, final ActionConvertorData data) {
+    public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         ClearActionsCaseBuilder clearActionsCaseBuilder = new ClearActionsCaseBuilder();
         InstructionBuilder instructionBuilder = new InstructionBuilder();
         instructionBuilder.setInstructionChoice(clearActionsCaseBuilder.build());
index c3f66b033a816c28b6dcf824ffcfa031f88b54f3..997f6b6f15eb3be8308ea006b7627e8b13dee04e 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.case
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTable;
@@ -25,7 +26,7 @@ public class GoToTableCase extends ConvertorCase<org.opendaylight.yang.gen.v1.ur
     }
 
     @Override
-    public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase source, final ActionConvertorData data) {
+    public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         GoToTable goToTable = source.getGoToTable();
         GotoTableCaseBuilder gotoTableCaseBuilder = new GotoTableCaseBuilder();
         GotoTableBuilder gotoTableBuilder = new GotoTableBuilder();
index 20913d43bcce817ae2f2c20fcd1d313c7611835d..293fd39ebfc6d7d138dcc41611b6be7f2907cb64 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.case
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.Meter;
@@ -25,7 +26,7 @@ public class MeterCase extends ConvertorCase<org.opendaylight.yang.gen.v1.urn.op
     }
 
     @Override
-    public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCase source, final ActionConvertorData data) {
+    public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         Meter meter = source.getMeter();
         MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
         MeterBuilder meterBuilder = new MeterBuilder();
index f3b83bd20fd71e602dc1e5d7c69bbda7f94c7cfe..198bbd1ca365a25a0824f3e3d0cc6fac50f94bf0 100644 (file)
@@ -13,7 +13,7 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.actions._case.WriteActions;
@@ -29,13 +29,12 @@ public class WriteActionsCase extends ConvertorCase<org.opendaylight.yang.gen.v1
     }
 
     @Override
-    public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase source, final ActionConvertorData data) {
+    public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         WriteActions writeActions = source.getWriteActions();
         WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
         WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
 
-        final Optional<List<Action>> actions = ConvertorManager.getInstance().convert(
-                writeActions.getAction(), data);
+        final Optional<List<Action>> actions = convertorExecutor.convert(writeActions.getAction(), data);
 
         writeActionsBuilder.setAction(actions.orElse(Collections.emptyList()));
         writeActionsCaseBuilder.setWriteActions(writeActionsBuilder.build());
index 87b3afd5bc5dd1846c4a7e7022367adec90ff9fd..20938e845a318f22b742681f27ed6e154397f3a7 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.case
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
@@ -26,7 +27,7 @@ public class WriteMetadataCase extends ConvertorCase<org.opendaylight.yang.gen.v
     }
 
     @Override
-    public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCase source, final ActionConvertorData data) {
+    public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
         WriteMetadata writeMetadata = source.getWriteMetadata();
         WriteMetadataCaseBuilder writeMetadataCaseBuilder = new WriteMetadataCaseBuilder();
         WriteMetadataBuilder writeMetadataBuilder = new WriteMetadataBuilder();
index 40f76a7c68a63f2c7db8629536c00b5c52c05e3c..96e99d982ea3145d283981f161e27bb4ee86af21 100644 (file)
@@ -8,33 +8,20 @@
 
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.flowflag;
 
-import java.util.Collection;
-import java.util.Collections;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 /**
  * converting from MD-SAL match model into appropriate OF-API match model
  *
  * @param <E> type of converted match
  */
-public interface FlowFlagConvertor<E> extends Convertor<FlowModFlags, E, VersionConvertorData> {
-
-    @Override
-    default Collection<Class<? extends DataContainer>> getTypes() {
-        return Collections.singleton(DataContainer.class);
-    }
-
-    @Override
-    default E convert(FlowModFlags source, VersionConvertorData data) {
-        return convert(source);
-    }
-    
+public interface FlowFlagConvertor<E> extends ConvertReactorConvertor<FlowModFlags, E> {
     /**
      * @param source flow mode flags
+     * @param convertorExecutor
      * @return converted match (into OF-API model)
      */
-    E convert(FlowModFlags source);
+    E convert(FlowModFlags source, ConvertorExecutor convertorExecutor);
 }
index 7cd4b5d6852c75432cab321d2f66f337a2f9af81..b921939ca88a14d27f77288c2d0c64f160654bb2 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.flow
 
 import java.util.Map;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.InjectionKey;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorKey;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ResultInjector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
 
@@ -34,8 +34,8 @@ public class FlowFlagReactor extends ConvertReactor<FlowModFlags> {
     }
 
     @Override
-    protected void initMappings(final Map<Short, Convertor<FlowModFlags, ?, ?>> conversions,
-                                final Map<InjectionKey, ResultInjector<?, ?>> injections) {
+    protected void initMappings(final Map<Short, ConvertReactorConvertor<FlowModFlags, ?>> conversions,
+                                final Map<ConvertorKey, ResultInjector<?, ?>> injections) {
         FlowFlagReactorMappingFactory.addFlowFlagsConvertors(conversions);
         FlowFlagReactorMappingFactory.addFlowFlagsIjectors(injections);
     }
index b7b3e00b925db0ff34371b5f48303cbec19687a3..c76814e97c91e2f7a594850e56101eddbde82153 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.flow
 
 import java.util.Map;
 import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.InjectionKey;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorKey;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ResultInjector;
 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.FlowModFlagsV10;
@@ -27,7 +27,7 @@ public class FlowFlagReactorMappingFactory {
     /**
      * @param conversionMapping conversion mapping
      */
-    public static void addFlowFlagsConvertors(final Map<Short, Convertor<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags, ?, ?>> conversionMapping) {
+    public static void addFlowFlagsConvertors(final Map<Short, ConvertReactorConvertor<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags, ?>> conversionMapping) {
         conversionMapping.put(OFConstants.OFP_VERSION_1_3, new FlowFlagsConvertorImpl());
         conversionMapping.put(OFConstants.OFP_VERSION_1_0, new FlowFlagsConvertorV10Impl());
     }
@@ -35,9 +35,9 @@ public class FlowFlagReactorMappingFactory {
     /**
      * @param injectionMapping injection mapping
      */
-    public static void addFlowFlagsIjectors(final Map<InjectionKey, ResultInjector<?, ?>> injectionMapping) {
+    public static void addFlowFlagsIjectors(final Map<ConvertorKey, ResultInjector<?, ?>> injectionMapping) {
         // OF-1.3|FlowModFlags --> FlowModInputBuilder
-        injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_3, FlowModInputBuilder.class),
+        injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, FlowModInputBuilder.class),
                 new ResultInjector<FlowModFlags, FlowModInputBuilder>() {
                     @Override
                     public void inject(final FlowModFlags value,
@@ -47,7 +47,7 @@ public class FlowFlagReactorMappingFactory {
                 });
 
         // OF-1.3|FlowModFlagsV10 --> FlowModInputBuilder
-        injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_0, FlowModInputBuilder.class),
+        injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_0, FlowModInputBuilder.class),
                 new ResultInjector<FlowModFlagsV10, FlowModInputBuilder>() {
                     @Override
                     public void inject(final FlowModFlagsV10 value,
index 3604727c529d8cadd73ac49b322be16f423c1318..d33a973a4de08fa6a65cb3868e5d15a0f2f5b73f 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.flowflag;
 
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
 
@@ -18,7 +19,7 @@ public class FlowFlagsConvertorImpl implements FlowFlagConvertor<FlowModFlags> {
 
     @Override
     public FlowModFlags convert(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags source) {
+            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags source, ConvertorExecutor convertorExecutor) {
 
         FlowModFlags ofFlowModFlags;
         if (source != null) {
index f37f03760c535b496d28062481f4c15f0add006e..73021119e0a8d7c5f835e0a23380f5a3d86be1ab 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.flowflag;
 
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlagsV10;
@@ -19,7 +20,7 @@ public class FlowFlagsConvertorV10Impl implements FlowFlagConvertor<FlowModFlags
 
     @Override
     public FlowModFlagsV10 convert(
-            FlowModFlags source) {
+            FlowModFlags source, ConvertorExecutor convertorExecutor) {
 
         FlowModFlagsV10 ofFlowModFlags;
         if (source != null) {
index 86572cc03da98aeafaf4f65aa5f82a48ef278794..b4a027329e98b96527fb0957f8a554350ecb553d 100644 (file)
@@ -8,33 +8,20 @@
 
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
 
-import java.util.Collection;
-import java.util.Collections;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 /**
  * converting from MD-SAL match model into appropriate OF-API match model
  *
  * @param <E> type of converted match
  */
-public interface MatchConvertor<E> extends Convertor<Match, E, VersionConvertorData> {
-
-    @Override
-    default Collection<Class<? extends DataContainer>> getTypes() {
-        return Collections.singleton(DataContainer.class);
-    }
-
-    @Override
-    default E convert(Match source, VersionConvertorData data) {
-        return convert(source);
-    }
-    
+public interface MatchConvertor<E> extends ConvertReactorConvertor<Match, E> {
     /**
      * @param source match input
+     * @param convertorExecutor
      * @return converted match (into OF-API model)
      */
-    E convert(Match source);
+    E convert(Match source, ConvertorExecutor convertorExecutor);
 }
index 3497f49dacec0e090abf360ddd12ca714cde09b7..9f273ed729971749c0fb07bf7242a9d10622abcd 100644 (file)
@@ -19,6 +19,7 @@ import org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionResolvers;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.OFApprovedExperimenterIds;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorProcessor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cases.SalToOfArpMatchCase;
@@ -138,16 +139,16 @@ public class MatchConvertorImpl implements MatchConvertor<List<MatchEntry>> {
 
     private static final byte[] VLAN_VID_MASK = new byte[]{16, 0};
 
-    private static void layer3Match(final List<MatchEntry> matchEntryList, final Layer3Match layer3Match) {
-        java.util.Optional<List<MatchEntry>> result = LAYER3_PROCESSOR.process(layer3Match);
+    private static void layer3Match(final List<MatchEntry> matchEntryList, final Layer3Match layer3Match, ConvertorExecutor convertorExecutor) {
+        java.util.Optional<List<MatchEntry>> result = LAYER3_PROCESSOR.process(layer3Match, convertorExecutor);
 
         if (result.isPresent()) {
             matchEntryList.addAll(result.get());
         }
     }
 
-    private static void layer4Match(final List<MatchEntry> matchEntryList, final Layer4Match layer4Match) {
-        java.util.Optional<List<MatchEntry>> result = LAYER4_PROCESSOR.process(layer4Match);
+    private static void layer4Match(final List<MatchEntry> matchEntryList, final Layer4Match layer4Match, ConvertorExecutor convertorExecutor) {
+        java.util.Optional<List<MatchEntry>> result = LAYER4_PROCESSOR.process(layer4Match, convertorExecutor);
 
         if (result.isPresent()) {
             matchEntryList.addAll(result.get());
@@ -579,7 +580,7 @@ public class MatchConvertorImpl implements MatchConvertor<List<MatchEntry>> {
     }
 
     @Override
-    public List<MatchEntry> convert(final Match match) {
+    public List<MatchEntry> convert(final Match match, ConvertorExecutor convertorExecutor) {
         List<MatchEntry> result = new ArrayList<>();
 
         if (match == null) {
@@ -592,10 +593,10 @@ public class MatchConvertorImpl implements MatchConvertor<List<MatchEntry>> {
         ethernetMatch(result, match.getEthernetMatch());
         vlanMatch(result, match.getVlanMatch());
         ipMatch(result, match.getIpMatch());
-        layer4Match(result, match.getLayer4Match());
+        layer4Match(result, match.getLayer4Match(), convertorExecutor);
         icmpv4Match(result, match.getIcmpv4Match());
         icmpv6Match(result, match.getIcmpv6Match());
-        layer3Match(result, match.getLayer3Match());
+        layer3Match(result, match.getLayer3Match(), convertorExecutor);
         protocolMatchFields(result, match.getProtocolMatchFields());
         tunnelMatch(result, match.getTunnel());
         tcpFlagsMatch(result, match.getTcpFlagsMatch());
index 90236ab912bccd94b80eaabb3b22226328a64630..2046508949793127fd7b0dd826a60ec28bffaa1b 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
 
 import java.util.Iterator;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.util.ActionUtil;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
@@ -205,10 +206,11 @@ public class MatchConvertorV10Impl implements MatchConvertor<MatchV10> {
      * Method builds openflow 1.0 specific match (MatchV10) from MD-SAL match.
      *
      * @param match MD-SAL match
+     * @param convertorExecutor
      * @return OF-API match
      */
     @Override
-    public MatchV10 convert(final Match match) {
+    public MatchV10 convert(final Match match, ConvertorExecutor convertorExecutor) {
         MatchV10Builder matchBuilder = new MatchV10Builder();
         boolean _dLDST = true;
         boolean _dLSRC = true;
index 28203dff183d358698ba0af04867596ab0c72b44..3c31f4d1011fad9a985d7b7772891fe7828f92d6 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
 
 import java.util.Map;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.InjectionKey;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorKey;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ResultInjector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
 
@@ -34,8 +34,8 @@ public class MatchReactor extends ConvertReactor<Match> {
     }
 
     @Override
-    protected void initMappings(final Map<Short, Convertor<Match, ?, ?>> conversions,
-                                final Map<InjectionKey, ResultInjector<?, ?>> injections) {
+    protected void initMappings(final Map<Short, ConvertReactorConvertor<Match, ?>> conversions,
+                                final Map<ConvertorKey, ResultInjector<?, ?>> injections) {
         MatchReactorMappingFactory.addMatchConvertors(conversions);
         MatchReactorMappingFactory.addMatchIjectors(injections);
     }
index 5cc91b37487a0f04273614bb7f17fd41c8ff91fa..f10fce499655253c105abaaa05086f3605b7ee4e 100644 (file)
@@ -11,8 +11,8 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
 import java.util.List;
 import java.util.Map;
 import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.InjectionKey;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorKey;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ResultInjector;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertor;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
@@ -34,7 +34,7 @@ public class MatchReactorMappingFactory {
     /**
      * @param conversionMapping conversion mapping
      */
-    public static void addMatchConvertors(final Map<Short, Convertor<Match, ?, ?>> conversionMapping) {
+    public static void addMatchConvertors(final Map<Short, ConvertReactorConvertor<Match, ?>> conversionMapping) {
         conversionMapping.put(OFConstants.OFP_VERSION_1_3, new MatchConvertorImpl());
         conversionMapping.put(OFConstants.OFP_VERSION_1_0, new MatchConvertorV10Impl());
     }
@@ -42,9 +42,9 @@ public class MatchReactorMappingFactory {
     /**
      * @param injectionMapping injection mapping
      */
-    public static void addMatchIjectors(final Map<InjectionKey, ResultInjector<?, ?>> injectionMapping) {
+    public static void addMatchIjectors(final Map<ConvertorKey, ResultInjector<?, ?>> injectionMapping) {
         // OF-1.3|List<MatchEntries> --> FlowModInputBuilder
-        injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_3, FlowModInputBuilder.class),
+        injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, FlowModInputBuilder.class),
                 new ResultInjector<List<MatchEntry>, FlowModInputBuilder>() {
                     @Override
                     public void inject(final List<MatchEntry> value,
@@ -54,7 +54,7 @@ public class MatchReactorMappingFactory {
                 });
 
         // OF-1.3|List<MatchEntries> --> OxmFieldsActionBuilder
-        injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_3, SetFieldActionBuilder.class),
+        injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, SetFieldActionBuilder.class),
                 new ResultInjector<List<MatchEntry>, SetFieldActionBuilder>() {
                     @Override
                     public void inject(final List<MatchEntry> value,
@@ -64,7 +64,7 @@ public class MatchReactorMappingFactory {
                 });
 
         // OF-1.0|MatchV10Builder --> FlowModInputBuilder
-        injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_0, FlowModInputBuilder.class),
+        injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_0, FlowModInputBuilder.class),
                 new ResultInjector<MatchV10, FlowModInputBuilder>() {
                     @Override
                     public void inject(final MatchV10 value,
@@ -74,7 +74,7 @@ public class MatchReactorMappingFactory {
                 });
 
         // OF-1.3|List<MatchEntries> --> MultipartRequestFlowBuilder
-        injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_3, MultipartRequestFlowBuilder.class),
+        injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, MultipartRequestFlowBuilder.class),
                 new ResultInjector<List<MatchEntry>, MultipartRequestFlowBuilder>() {
                     @Override
                     public void inject(final List<MatchEntry> value,
@@ -84,7 +84,7 @@ public class MatchReactorMappingFactory {
                 });
 
         // OF-1.0|List<MatchEntries> --> MultipartRequestFlowBuilder
-        injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_0, MultipartRequestFlowBuilder.class),
+        injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_0, MultipartRequestFlowBuilder.class),
                 new ResultInjector<MatchV10, MultipartRequestFlowBuilder>() {
                     @Override
                     public void inject(final MatchV10 value,
@@ -94,7 +94,7 @@ public class MatchReactorMappingFactory {
                 });
 
         // OF-1.3|List<MatchEntries> --> MultipartRequestAggregateBuilder
-        injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_3, MultipartRequestAggregateBuilder.class),
+        injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_3, MultipartRequestAggregateBuilder.class),
                 new ResultInjector<List<MatchEntry>, MultipartRequestAggregateBuilder>() {
                     @Override
                     public void inject(final List<MatchEntry> value,
@@ -104,7 +104,7 @@ public class MatchReactorMappingFactory {
                 });
 
         // OF-1.0|List<MatchEntries> --> MultipartRequestAggregateBuilder
-        injectionMapping.put(new InjectionKey(OFConstants.OFP_VERSION_1_0, MultipartRequestAggregateBuilder.class),
+        injectionMapping.put(new ConvertorKey(OFConstants.OFP_VERSION_1_0, MultipartRequestAggregateBuilder.class),
                 new ResultInjector<MatchV10, MultipartRequestAggregateBuilder>() {
                     @Override
                     public void inject(final MatchV10 value,
index f15310ef4c22d3944b5482e69fef4bb3ad65a99e..2529f37fbe8f579ffa116d6f7d01d209d06158c9 100644 (file)
@@ -92,11 +92,11 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  * {@code
  * VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
  * data.setDatapathId(datapathId);
- * Optional<MatchBuilder> salMatch = ConvertorManager.getInstance().convert(ofMatch, data);
+ * Optional<MatchBuilder> salMatch = convertorManager.convert(ofMatch, data);
  * }
  * </pre>
  */
-public class MatchResponseConvertor implements Convertor<MatchEntriesGrouping, MatchBuilder, VersionDatapathIdConvertorData> {
+public class MatchResponseConvertor extends Convertor<MatchEntriesGrouping, MatchBuilder, VersionDatapathIdConvertorData> {
     private static final ConvertorProcessor<MatchEntryValue, MatchBuilder, MatchResponseConvertorData> OF_TO_SAL_PROCESSOR = new ConvertorProcessor<MatchEntryValue, MatchBuilder, MatchResponseConvertorData>()
             .addCase(new OfToSalInPortCase())
             .addCase(new OfToSalInPhyPortCase())
@@ -186,10 +186,10 @@ public class MatchResponseConvertor implements Convertor<MatchEntriesGrouping, M
                  * org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value
                  * and proper use of it can fix this bug.
                  */
-                OF_TO_SAL_TUNNEL_PROCESSOR.process(ofMatch.getMatchEntryValue(), data);
+                OF_TO_SAL_TUNNEL_PROCESSOR.process(ofMatch.getMatchEntryValue(), data, getConvertorExecutor());
             } else {
                 data.setOxmMatchField(ofMatch.getOxmMatchField());
-                OF_TO_SAL_PROCESSOR.process(ofMatch.getMatchEntryValue(), data);
+                OF_TO_SAL_PROCESSOR.process(ofMatch.getMatchEntryValue(), data, getConvertorExecutor());
             }
         }
 
index 82afc16bcc613c5810b3a682b0befa028bcfde14..742ddc032e1ab4069317acc61f9153ff1ef2fdd6 100644 (file)
@@ -44,11 +44,11 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  * {@code
  * VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(version);
  * data.setDatapathId(datapathId);
- * Optional<MatchBuilder> salMatch = ConvertorManager.getInstance().convert(ofMatchV10, data);
+ * Optional<MatchBuilder> salMatch = convertorManager.convert(ofMatchV10, data);
  * }
  * </pre>
  */
-public class MatchV10ResponseConvertor implements Convertor<MatchV10, MatchBuilder, VersionDatapathIdConvertorData> {
+public class MatchV10ResponseConvertor extends Convertor<MatchV10, MatchBuilder, VersionDatapathIdConvertorData> {
     private static final short PROTO_TCP = 6;
     private static final short PROTO_UDP = 17;
     private static final short PROTO_ICMPV4 = 1;
index 4e4a15f59e98cc8c433665157df36e4a374339e5..e777edf56cd4968335c6874cbc1c761f4f3ac6f3 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalArpOpCase extends ConvertorCase<ArpOpCase, MatchBuilder, Mat
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull ArpOpCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull ArpOpCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final ArpMatchBuilder arpMatchBuilder = data.getArpMatchBuilder();
 
index 552fd2f16ff7f58aa8098525b849cf904bfd2b02..ca42239d5d0095177b9621ac64f2520f20707beb 100644 (file)
@@ -12,6 +12,7 @@ import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowjava.util.ByteBufUtils;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
@@ -27,7 +28,7 @@ public class OfToSalArpShaCase extends ConvertorCase<ArpShaCase, MatchBuilder, M
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull ArpShaCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull ArpShaCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final ArpMatchBuilder arpMatchBuilder = data.getArpMatchBuilder();
 
index 05782f9eaa05207a903318d041918168480e6648..04eda9d2c4ee2baa8fadd5efbdb0d6a58aa8945a 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
@@ -26,7 +27,7 @@ public class OfToSalArpSpaCase extends ConvertorCase<ArpSpaCase, MatchBuilder, M
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull ArpSpaCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull ArpSpaCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final ArpMatchBuilder arpMatchBuilder = data.getArpMatchBuilder();
 
index 030bc38046dfc6753b1d99991ab787ec0c4f686f..67c06a48a19e0a22ecb24be6e4adf01da97a6b72 100644 (file)
@@ -12,6 +12,7 @@ import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowjava.util.ByteBufUtils;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
@@ -27,7 +28,7 @@ public class OfToSalArpThaCase extends ConvertorCase<ArpThaCase, MatchBuilder, M
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull ArpThaCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull ArpThaCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final ArpMatchBuilder arpMatchBuilder = data.getArpMatchBuilder();
 
index 843f5dac904e419f8d9bd93fc38baa475d0f3eba..e79eb3e0bd8a44f45796d940cb5a2a0d04f33d35 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
@@ -26,7 +27,7 @@ public class OfToSalArpTpaCase extends ConvertorCase<ArpTpaCase, MatchBuilder, M
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull ArpTpaCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull ArpTpaCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final ArpMatchBuilder arpMatchBuilder = data.getArpMatchBuilder();
 
index b2af4783361abd8c50f11b7031a65b73329a0cfd..2653eac5b5c33e8f3265012ce2fb101ecd22f792 100644 (file)
@@ -13,6 +13,7 @@ import static org.opendaylight.openflowjava.util.ByteBufUtils.macAddressToString
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
@@ -28,7 +29,7 @@ public class OfToSalEthDstCase extends ConvertorCase<EthDstCase, MatchBuilder, M
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull EthDstCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull EthDstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final EthernetMatchBuilder ethMatchBuilder = data.getEthernetMatchBuilder();
 
index fec3bfdc4f01fe4d3b74511f92c590c98239ec56..f4c12d96dd309e783e4e423588625358e10320cf 100644 (file)
@@ -13,6 +13,7 @@ import static org.opendaylight.openflowjava.util.ByteBufUtils.macAddressToString
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
@@ -28,7 +29,7 @@ public class OfToSalEthSrcCase extends ConvertorCase<EthSrcCase, MatchBuilder, M
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull EthSrcCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull EthSrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final EthernetMatchBuilder ethMatchBuilder = data.getEthernetMatchBuilder();
 
index c69bddb8c4cba4ed82ee91a864206443848c8dab..7a6e532e0dccb2b3f44bb261459409b81ce01d98 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -26,7 +27,7 @@ public class OfToSalEthTypeCase extends ConvertorCase<EthTypeCase, MatchBuilder,
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull EthTypeCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull EthTypeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final EthernetMatchBuilder ethMatchBuilder = data.getEthernetMatchBuilder();
 
index ff4ac0794076b3d8312abf62b954a269936d6c62..22bc6f01941347faadeb2d4754d78d89f0d50798 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
@@ -26,7 +27,7 @@ public class OfToSalExperimenterIdCase extends ConvertorCase<ExperimenterIdCase,
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull ExperimenterIdCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull ExperimenterIdCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
 
         if (data.getOxmMatchField().equals(TcpFlags.class)) {
index 7241695625e422f1af3427e09a87d4c8b1fcbb6f..d5fa2c7e4765c7ac2eceda9811be24cd6a8945c8 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalIcmpv4CodeCase extends ConvertorCase<Icmpv4CodeCase, MatchBu
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Icmpv4CodeCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Icmpv4CodeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Icmpv4MatchBuilder icmpv4MatchBuilder = data.getIcmpv4MatchBuilder();
 
index 93ccedae5b9e9cbd3fd942e9e7faf26a9383c3e3..749bde8b6a70951fe7b56645f6692cf09e4bed99 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalIcmpv4TypeCase extends ConvertorCase<Icmpv4TypeCase, MatchBu
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Icmpv4TypeCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Icmpv4TypeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Icmpv4MatchBuilder icmpv4MatchBuilder = data.getIcmpv4MatchBuilder();
 
index b824b2194a6766ba81b50b59f3863d42e3b6c52d..268e8255bb497306e4e8e3741c2d13089450ca6e 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalIcmpv6CodeCase extends ConvertorCase<Icmpv6CodeCase, MatchBu
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Icmpv6CodeCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Icmpv6CodeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Icmpv6MatchBuilder icmpv6MatchBuilder = data.getIcmpv6MatchBuilder();
 
index e0f296c81e90a4a1c211041e5d71484113dbc8ea..384e0e45152c3fa65cea3b0f4581e7fd18a5ef81 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalIcmpv6TypeCase extends ConvertorCase<Icmpv6TypeCase, MatchBu
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Icmpv6TypeCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Icmpv6TypeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Icmpv6MatchBuilder icmpv6MatchBuilder = data.getIcmpv6MatchBuilder();
 
index faeb92ac18bf1d553de6b7e15b0d16b12d32e6db..106682bf9f9dbe3f90ad31644d4e7652d9dd8e8a 100644 (file)
@@ -13,6 +13,7 @@ import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
@@ -26,7 +27,7 @@ public class OfToSalInPhyPortCase extends ConvertorCase<InPhyPortCase, MatchBuil
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull InPhyPortCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull InPhyPortCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final OpenflowVersion ofVersion = OpenflowVersion.get(data.getVersion());
         final BigInteger datapathId = data.getDatapathId();
index 3283b8d652db7a3451825e4ed3feb3f9cec4e939..9df2b5f744d5b9539dcec8edf3690c0263a13225 100644 (file)
@@ -13,6 +13,7 @@ import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
@@ -26,7 +27,7 @@ public class OfToSalInPortCase extends ConvertorCase<InPortCase, MatchBuilder, M
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull InPortCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull InPortCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final OpenflowVersion ofVersion = OpenflowVersion.get(data.getVersion());
         final BigInteger datapathId = data.getDatapathId();
index 2cd568bdd916afd3b4a6343895f712c30570f889..4111e275aa7e534e65e8daf02ee4fe6067cbf830 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
@@ -25,7 +26,7 @@ public class OfToSalIpDscpCase extends ConvertorCase<IpDscpCase, MatchBuilder, M
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull IpDscpCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull IpDscpCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final IpMatchBuilder ipMatchBuilder = data.getIpMatchBuilder();
 
index f999efc9b1bead6f22be254897a49dc2aa6691f2..c87e62362cd8c55e1a65647fb567a32190d0b9f9 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalIpEcnCase extends ConvertorCase<IpEcnCase, MatchBuilder, Mat
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull IpEcnCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull IpEcnCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final IpMatchBuilder ipMatchBuilder = data.getIpMatchBuilder();
 
index a262198c704d67a8c7a553cba16f5115e31a5ee2..6a9cd6b4790b4bb440cc1fc3579d16fa9e96895a 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalIpProtoCase extends ConvertorCase<IpProtoCase, MatchBuilder,
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull IpProtoCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull IpProtoCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final IpMatchBuilder ipMatchBuilder = data.getIpMatchBuilder();
 
index dc417df24d78fa610aad6dca9672162bd1ece2f8..ba55abe4c1d067faed29d846ef12a0a37c496da1 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
@@ -64,7 +65,7 @@ public class OfToSalIpv4DstCase extends ConvertorCase<Ipv4DstCase, MatchBuilder,
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Ipv4DstCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Ipv4DstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Ipv4MatchBuilder ipv4MatchBuilder = data.getIpv4MatchBuilder();
         final Ipv4MatchArbitraryBitMaskBuilder ipv4MatchArbitraryBitMaskBuilder = data.getIpv4MatchArbitraryBitMaskBuilder();
index 9098a6a66ac07371314836f479335260f1589ff2..3fc8de65a6d23be3c544c2b6d6df96948b3d6528 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
@@ -64,7 +65,7 @@ public class OfToSalIpv4SrcCase extends ConvertorCase<Ipv4SrcCase, MatchBuilder,
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Ipv4SrcCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Ipv4SrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Ipv4MatchBuilder ipv4MatchBuilder = data.getIpv4MatchBuilder();
         final Ipv4MatchArbitraryBitMaskBuilder ipv4MatchArbitraryBitMaskBuilder = data.getIpv4MatchArbitraryBitMaskBuilder();
index 6fd2a136a48d2f68ed8f83ffe3203b8dc6636005..da1272ea1ea8106ce3e772041ca451f4a2250fbe 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
@@ -29,7 +30,7 @@ public class OfToSalIpv6DstCase extends ConvertorCase<Ipv6DstCase, MatchBuilder,
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Ipv6DstCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Ipv6DstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
         final Ipv6MatchArbitraryBitMaskBuilder ipv6MatchArbitraryBitMaskBuilder = data.getIpv6MatchArbitraryBitMaskBuilder();
index b3b5abaaf40d4269d7a55c55e0ccfb9dfcfb1431..ee65a3834afcba48fa6b6c53919426d9c26d7dbe 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
@@ -28,7 +29,7 @@ public class OfToSalIpv6ExthdrCase extends ConvertorCase<Ipv6ExthdrCase, MatchBu
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Ipv6ExthdrCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Ipv6ExthdrCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
 
index d0434847d69b6d4c4621e3e1e1b89e6ec7572089..97679320d43812481632a4499bf7e7bff424f22a 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
@@ -27,7 +28,7 @@ public class OfToSalIpv6FlabelCase extends ConvertorCase<Ipv6FlabelCase, MatchBu
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Ipv6FlabelCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Ipv6FlabelCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
 
index 2cdb2ab2b2581416c3ce9477b889e895fd7e4d3b..15d83ce0569bf944a8ecc0e1f7868279b9af3c8c 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalIpv6NdSllCase extends ConvertorCase<Ipv6NdSllCase, MatchBuil
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Ipv6NdSllCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Ipv6NdSllCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
 
index 36a3339439f58de425ab37a739e58833db6df35f..667a5e6c674e1a5f2383cea0b5ebf4c214e1b520 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalIpv6NdTargetCase extends ConvertorCase<Ipv6NdTargetCase, Mat
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Ipv6NdTargetCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Ipv6NdTargetCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
 
index 25153d0e3b4ed51594dd3043e4f0ae37759eb092..7f8418705adaacdd4839a09dd41b39845a2fde43 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalIpv6NdTllCase extends ConvertorCase<Ipv6NdTllCase, MatchBuil
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Ipv6NdTllCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Ipv6NdTllCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
 
index 981bdf8166adc9f25672e64837d2473bba04c975..2cb8803f1b1753d8f524d28b88dd114424719ade 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
@@ -29,7 +30,7 @@ public class OfToSalIpv6SrcCase extends ConvertorCase<Ipv6SrcCase, MatchBuilder,
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Ipv6SrcCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Ipv6SrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
         final Ipv6MatchArbitraryBitMaskBuilder ipv6MatchArbitraryBitMaskBuilder = data.getIpv6MatchArbitraryBitMaskBuilder();
index 179c6dac39d23d874d7d3945c5e8b4a78ed788a9..9f924940b98d7291962c3e0dbed3ebd9d43e3cc7 100644 (file)
@@ -12,6 +12,7 @@ import java.math.BigInteger;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -25,7 +26,7 @@ public class OfToSalMetadataCase extends ConvertorCase<MetadataCase, MatchBuilde
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull MetadataCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull MetadataCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final MetadataBuilder metadataBuilder = new MetadataBuilder();
         final Metadata metadata = source.getMetadata();
index 8e70ca581a062b69af9899088150bdeb412dfbca..38ae6c2371e034f86ea8c8a6cd3e01c792dccaa7 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalMplsBosCase extends ConvertorCase<MplsBosCase, MatchBuilder,
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull MplsBosCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull MplsBosCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = data.getProtocolMatchFieldsBuilder();
 
index dd26627586be303028a3c3492bf5b2c935198517..cf53c8bfce0912cc19dd31d4896c164d9428e7da 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalMplsLabelCase extends ConvertorCase<MplsLabelCase, MatchBuil
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull MplsLabelCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull MplsLabelCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = data.getProtocolMatchFieldsBuilder();
 
index 7005fc08d516082dc2ede84f9faaa54ffcfef55a..6fcc8d7e5d54a5ba47d01af52d6bb5ea8b0c9c30 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalMplsTcCase extends ConvertorCase<MplsTcCase, MatchBuilder, M
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull MplsTcCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull MplsTcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = data.getProtocolMatchFieldsBuilder();
 
index 1d7d25c4217b05c102f9a71485f95d0b1b9e1b1a..57b876c66e815f1b3c1fb020b1f9bd391b52d807 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
@@ -26,7 +27,7 @@ public class OfToSalPbbIsidCase extends ConvertorCase<PbbIsidCase, MatchBuilder,
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull PbbIsidCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull PbbIsidCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = data.getProtocolMatchFieldsBuilder();
 
index fea5b8399c9cc5404b99d8a8891904f54f0b4713..7046a9b5ffd68cefafbd223aef5628f0f2a32d57 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
@@ -25,7 +26,7 @@ public class OfToSalSctpDstCase extends ConvertorCase<SctpDstCase, MatchBuilder,
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull SctpDstCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull SctpDstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final SctpMatchBuilder sctpMatchBuilder = data.getSctpMatchBuilder();
 
index c5bcb92ef70668d9aeb1171dac2883d30000fba6..d9549a886c35814558eef37499bd248347de145d 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
@@ -25,7 +26,7 @@ public class OfToSalSctpSrcCase extends ConvertorCase<SctpSrcCase, MatchBuilder,
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull SctpSrcCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull SctpSrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final SctpMatchBuilder sctpMatchBuilder = data.getSctpMatchBuilder();
 
index 76914b9a061668e6ccb3a40a065106aa4208b8e1..6dcee21beb1d3e6472e1d75237b9e8189c445622 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
@@ -25,7 +26,7 @@ public class OfToSalTcpDstCase extends ConvertorCase<TcpDstCase, MatchBuilder, M
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull TcpDstCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull TcpDstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final TcpMatchBuilder tcpMatchBuilder = data.getTcpMatchBuilder();
 
index 75780742b1eb6e759a19ae1e1bed0b8baec8de8e..503cabef94f50468a8181ab6c750f19753bab974 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalTcpSrcCase extends ConvertorCase<TcpSrcCase, MatchBuilder, M
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull TcpSrcCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull TcpSrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final TcpMatchBuilder tcpMatchBuilder = data.getTcpMatchBuilder();
 
index 389f8cd3f1a0e1be3f50acfc95b6c52aa2136026..dab5b3cad7a8973dec7cadb4cd1103e3cfbed465 100644 (file)
@@ -12,6 +12,7 @@ import java.math.BigInteger;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -25,7 +26,7 @@ public class OfToSalTunnelIdCase extends ConvertorCase<TunnelIdCase, MatchBuilde
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull TunnelIdCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull TunnelIdCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
 
         TunnelId tunnelId = source.getTunnelId();
index 733c1a886fcb73e96cd39105825a48be3a54284a..e5e5bab5f33fe54297842646c892be3f434e7ee4 100644 (file)
@@ -12,6 +12,7 @@ import java.nio.ByteBuffer;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
@@ -29,7 +30,7 @@ public class OfToSalTunnelIpv4DstCase extends ConvertorCase<Ipv4DstCase, MatchBu
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Ipv4DstCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Ipv4DstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Ipv4MatchBuilder ipv4MatchBuilder = data.getIpv4MatchBuilder();
         final TunnelIpv4MatchBuilder tunnelIpv4MatchBuilder = data.getTunnelIpv4MatchBuilder();
index 5586b3484fd47fdcf8b521d0fa7533e2059dacee..c84d9420c0c1097bb0412ed8fdf9b95dda515e06 100644 (file)
@@ -12,6 +12,7 @@ import java.nio.ByteBuffer;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
@@ -29,7 +30,7 @@ public class OfToSalTunnelIpv4SrcCase extends ConvertorCase<Ipv4SrcCase, MatchBu
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull Ipv4SrcCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull Ipv4SrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final Ipv4MatchBuilder ipv4MatchBuilder = data.getIpv4MatchBuilder();
         final TunnelIpv4MatchBuilder tunnelIpv4MatchBuilder = data.getTunnelIpv4MatchBuilder();
index 78776cebc5a962edf5acbb6e962505536ede1789..c3cacffcd07d6b9f6d4b89f0bc0f49c6e13dbcec 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalUdpDstCase extends ConvertorCase<UdpDstCase, MatchBuilder, M
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull UdpDstCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull UdpDstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final UdpMatchBuilder udpMatchBuilder = data.getUdpMatchBuilder();
 
index ec52f5624d1ab3502ce05ee6d6bb16b10877b29e..0dcf7f290aa6928dacd91073818d13a98034cb9d 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalUdpSrcCase extends ConvertorCase<UdpSrcCase, MatchBuilder, M
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull UdpSrcCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull UdpSrcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final UdpMatchBuilder udpMatchBuilder = data.getUdpMatchBuilder();
 
index 807c0b04aed582f739a4e5e31450cb1b9fd07c28..b862a46178974a3ab34c6bddaf61e239bd145b93 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -24,7 +25,7 @@ public class OfToSalVlanPcpCase extends ConvertorCase<VlanPcpCase, MatchBuilder,
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull VlanPcpCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull VlanPcpCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final VlanMatchBuilder vlanMatchBuilder = data.getVlanMatchBuilder();
 
index 89e387e6c37f294ae85ace9c502326a9a8fd9e91..edff8c63ad83214a43f5d95c3b7a4544ab891c5a 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.cas
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.data.MatchResponseConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -26,7 +27,7 @@ public class OfToSalVlanVidCase extends ConvertorCase<VlanVidCase, MatchBuilder,
     }
 
     @Override
-    public Optional<MatchBuilder> process(@Nonnull VlanVidCase source, MatchResponseConvertorData data) {
+    public Optional<MatchBuilder> process(@Nonnull VlanVidCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
         final MatchBuilder matchBuilder = data.getMatchBuilder();
         final VlanMatchBuilder vlanMatchBuilder = data.getVlanMatchBuilder();
 
index cb3bc6866272f2e7aeb36f8f83fdd740380655a3..6ba10bdc1505a0320eeacff9bb0968a388bc1f98 100644 (file)
@@ -14,6 +14,7 @@ import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
@@ -48,7 +49,7 @@ public class SalToOfArpMatchCase extends ConvertorCase<ArpMatch, List<MatchEntry
     }
 
     @Override
-    public Optional<List<MatchEntry>> process(@Nonnull ArpMatch source, VersionConvertorData data) {
+    public Optional<List<MatchEntry>> process(@Nonnull ArpMatch source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
         List<MatchEntry> result = new ArrayList<>();
 
         if (source.getArpOp() != null) {
index 1100cc446af23a26ec96b8662e0ce5605ca7e100..b8cca513e6acfe569edbae95b57407f84faea5ea 100644 (file)
@@ -12,6 +12,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
@@ -33,7 +34,7 @@ public class SalToOfIpv4MatchArbitraryBitMaskCase extends ConvertorCase<Ipv4Matc
     }
 
     @Override
-    public Optional<List<MatchEntry>> process(@Nonnull Ipv4MatchArbitraryBitMask source, VersionConvertorData data) {
+    public Optional<List<MatchEntry>> process(@Nonnull Ipv4MatchArbitraryBitMask source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
         List<MatchEntry> result = new ArrayList<>();
 
         if (source.getIpv4SourceAddressNoMask() != null) {
index 1c7a907a3c09e4f933dfe026e8ca33ed00cfdba4..490575cf67841a9bc782c1dc96e2b61a42299748 100644 (file)
@@ -13,6 +13,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
@@ -36,7 +37,7 @@ public class SalToOfIpv4MatchCase extends ConvertorCase<Ipv4Match, List<MatchEnt
     }
 
     @Override
-    public Optional<List<MatchEntry>> process(@Nonnull Ipv4Match source, VersionConvertorData data) {
+    public Optional<List<MatchEntry>> process(@Nonnull Ipv4Match source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
         List<MatchEntry> result = new ArrayList<>();
 
         if (source.getIpv4Source() != null) {
index 9ab5674d0e315a0d56711df939272a94a57f4993..0f1056cc61debf4ba0bf11f968af3ebd1413e39a 100644 (file)
@@ -12,6 +12,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
@@ -33,7 +34,7 @@ public class SalToOfIpv6MatchArbitraryBitMaskCase extends ConvertorCase<Ipv6Matc
     }
 
     @Override
-    public Optional<List<MatchEntry>> process(@Nonnull Ipv6MatchArbitraryBitMask source, VersionConvertorData data) {
+    public Optional<List<MatchEntry>> process(@Nonnull Ipv6MatchArbitraryBitMask source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
         List<MatchEntry> result = new ArrayList<>();
 
         if (source.getIpv6SourceAddressNoMask() != null) {
index 374bc46ec15386db10a4e5f664340afd7c4ee509..ed9f8eb41ea56ebd56fcacb45c1ecba2f1cabed5 100644 (file)
@@ -12,6 +12,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
@@ -51,7 +52,7 @@ public class SalToOfIpv6MatchCase extends ConvertorCase<Ipv6Match, List<MatchEnt
     }
 
     @Override
-    public Optional<List<MatchEntry>> process(@Nonnull Ipv6Match source, VersionConvertorData data) {
+    public Optional<List<MatchEntry>> process(@Nonnull Ipv6Match source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
         List<MatchEntry> result = new ArrayList<>();
 
         if (source.getIpv6Source() != null) {
index 5cc9080bb21346f40d9fec551d9143b2237e60ac..e8197316e45621d707f8622192cd4b834eb2b886 100644 (file)
@@ -12,6 +12,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch;
@@ -31,7 +32,7 @@ public class SalToOfSctpMatchCase extends ConvertorCase<SctpMatch, List<MatchEnt
     }
 
     @Override
-    public Optional<List<MatchEntry>> process(@Nonnull SctpMatch source, VersionConvertorData data) {
+    public Optional<List<MatchEntry>> process(@Nonnull SctpMatch source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
         List<MatchEntry> result = new ArrayList<>();
 
         if (source.getSctpSourcePort() != null) {
index 4f6a3d69f40c8be185be880b9d16d5ced13f1dfc..61c5800c2e1fba0ff98bbfa944dd7f193324b067 100644 (file)
@@ -12,6 +12,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch;
@@ -31,7 +32,7 @@ public class SalToOfTcpMatchCase extends ConvertorCase<TcpMatch, List<MatchEntry
     }
 
     @Override
-    public Optional<List<MatchEntry>> process(@Nonnull TcpMatch source, VersionConvertorData data) {
+    public Optional<List<MatchEntry>> process(@Nonnull TcpMatch source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
         List<MatchEntry> result = new ArrayList<>();
 
         if (source.getTcpSourcePort() != null) {
index 88f8d49b20a3b59a2ce9233b84d012f73954759a..6b85e17f6d165673fc8a9511fbc23b5b6c0548b6 100644 (file)
@@ -13,6 +13,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
@@ -36,7 +37,7 @@ public class SalToOfTunnelIpv4MatchCase extends ConvertorCase<TunnelIpv4Match, L
     }
 
     @Override
-    public Optional<List<MatchEntry>> process(@Nonnull TunnelIpv4Match source, VersionConvertorData data) {
+    public Optional<List<MatchEntry>> process(@Nonnull TunnelIpv4Match source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
         List<MatchEntry> result = new ArrayList<>();
 
         if (source.getTunnelIpv4Source() != null) {
index 565c46aa4c6b61702646ca79024acbf4f30fe181..3979863d85f79068ff90a07de16a0e4bb17f8a04 100644 (file)
@@ -12,6 +12,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import javax.annotation.Nonnull;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorCase;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch;
@@ -31,7 +32,7 @@ public class SalToOfUdpMatchCase extends ConvertorCase<UdpMatch, List<MatchEntry
     }
 
     @Override
-    public Optional<List<MatchEntry>> process(@Nonnull UdpMatch source, VersionConvertorData data) {
+    public Optional<List<MatchEntry>> process(@Nonnull UdpMatch source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
         List<MatchEntry> result = new ArrayList<>();
 
         if (source.getUdpSourcePort() != null) {
index a889a67097901b324a9cccbc2bdce400ec6ee557..493771c3a1e497dd279e7a4c2a7ec2fe60b51089 100644 (file)
@@ -24,7 +24,7 @@ import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
 import org.opendaylight.openflowplugin.extension.api.AugmentTuple;
 import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
 import org.opendaylight.openflowplugin.openflow.md.core.extension.MatchExtensionHelper;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
@@ -159,6 +159,11 @@ public class FlowRemovedTranslator implements IMDMessageTranslator<OfHeader, Lis
 
     private static final Logger LOG = LoggerFactory.getLogger(FlowRemovedTranslator.class);
     private static final String PREFIX_SEPARATOR = "/";
+    private final ConvertorExecutor convertorExecutor;
+
+    public FlowRemovedTranslator(ConvertorExecutor convertorExecutor) {
+        this.convertorExecutor = convertorExecutor;
+    }
 
     @Override
     public List<DataObject> translate(final SwitchConnectionDistinguisher cookie, final SessionContext sc, final OfHeader msg) {
@@ -203,7 +208,7 @@ public class FlowRemovedTranslator implements IMDMessageTranslator<OfHeader, Lis
                 final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(sc.getPrimaryConductor().getVersion());
                 data.setDatapathId(sc.getFeatures().getDatapathId());
 
-                final Optional<MatchBuilder> matchBuilderOptional = ConvertorManager.getInstance().convert(ofFlow.getMatchV10(), data);
+                final Optional<MatchBuilder> matchBuilderOptional = convertorExecutor.convert(ofFlow.getMatchV10(), data);
                 salFlowRemoved.setMatch(matchBuilderOptional.orElse(new MatchBuilder()).build());
             }
             salFlowRemoved.setNode(new NodeRef(InventoryDataServiceUtil.identifierFromDatapathId(sc.getFeatures()
index 6ffe053519af534b38bab6aa5832b97e3457832a..e2f755ca3759af12b550689d0686185ad6912d97 100644 (file)
@@ -16,7 +16,8 @@ import java.util.concurrent.CopyOnWriteArrayList;
 import org.opendaylight.openflowplugin.api.openflow.md.core.IMDMessageTranslator;
 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
@@ -37,6 +38,11 @@ public class MultipartReplyTableFeaturesToTableUpdatedTranslator implements
 
     private static final Logger LOG = LoggerFactory
             .getLogger(MultipartReplyTableFeaturesToTableUpdatedTranslator.class);
+    private final ConvertorExecutor convertorExecutor;
+
+    public MultipartReplyTableFeaturesToTableUpdatedTranslator(ConvertorExecutor convertorExecutor) {
+        this.convertorExecutor = convertorExecutor;
+    }
 
     @Override
     public List<DataObject> translate(SwitchConnectionDistinguisher cookie, SessionContext sc, OfHeader msg) {
@@ -46,7 +52,7 @@ public class MultipartReplyTableFeaturesToTableUpdatedTranslator implements
 
             List<DataObject> listDataObject = new CopyOnWriteArrayList<>();
 
-            TableUpdatedBuilder message = new TableUpdatedBuilder() ;
+            TableUpdatedBuilder message = new TableUpdatedBuilder();
             message.setNode((new NodeRef(InventoryDataServiceUtil.identifierFromDatapathId(sc.getFeatures()
                     .getDatapathId()))));
             message.setMoreReplies(mpReply.getFlags().isOFPMPFREQMORE());
@@ -54,7 +60,8 @@ public class MultipartReplyTableFeaturesToTableUpdatedTranslator implements
             MultipartReplyTableFeaturesCase caseBody = (MultipartReplyTableFeaturesCase) mpReply.getMultipartReplyBody();
             MultipartReplyTableFeatures body = caseBody.getMultipartReplyTableFeatures();
 
-            final Optional<List<TableFeatures>> tableFeaturesList = ConvertorManager.getInstance().convert(body);
+            final VersionConvertorData data = new VersionConvertorData(sc.getPrimaryConductor().getVersion());
+            final Optional<List<TableFeatures>> tableFeaturesList = convertorExecutor.convert(body, data);
             message.setTableFeatures(tableFeaturesList.orElse(Collections.emptyList()));
             listDataObject.add( message.build()) ;
 
index 4872f58a8cc0f905a7b1a16767677a124abe9635..2e31766fa8572e73271110e3456279e5d24e85d9 100644 (file)
@@ -18,8 +18,7 @@ import org.opendaylight.openflowplugin.api.openflow.md.core.IMDMessageTranslator
 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
@@ -113,6 +112,11 @@ public class MultipartReplyTranslator implements IMDMessageTranslator<OfHeader,
 
     protected static final Logger logger = LoggerFactory
             .getLogger(MultipartReplyTranslator.class);
+    private final ConvertorExecutor convertorExecutor;
+
+    public MultipartReplyTranslator(ConvertorExecutor convertorExecutor) {
+        this.convertorExecutor = convertorExecutor;
+    }
 
 
     @Override
@@ -121,6 +125,8 @@ public class MultipartReplyTranslator implements IMDMessageTranslator<OfHeader,
         List<DataObject> listDataObject = new CopyOnWriteArrayList<DataObject>();
 
         OpenflowVersion ofVersion = OpenflowVersion.get(sc.getPrimaryConductor().getVersion());
+        final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(sc.getPrimaryConductor().getVersion());
+        data.setDatapathId(sc.getFeatures().getDatapathId());
 
         if(msg instanceof MultipartReplyMessage){
             MultipartReplyMessage mpReply = (MultipartReplyMessage)msg;
@@ -134,10 +140,8 @@ public class MultipartReplyTranslator implements IMDMessageTranslator<OfHeader,
                 message.setTransactionId(generateTransactionId(mpReply.getXid()));
                 MultipartReplyFlowCase caseBody = (MultipartReplyFlowCase)mpReply.getMultipartReplyBody();
                 MultipartReplyFlow replyBody = caseBody.getMultipartReplyFlow();
-                final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(sc.getPrimaryConductor().getVersion());
-                data.setDatapathId(sc.getFeatures().getDatapathId());
 
-                final Optional<List<FlowAndStatisticsMapList>> flowAndStatisticsMapLists = ConvertorManager.getInstance().convert(replyBody.getFlowStats(), data);
+                final Optional<List<FlowAndStatisticsMapList>> flowAndStatisticsMapLists = convertorExecutor.convert(replyBody.getFlowStats(), data);
 
                 message.setFlowAndStatisticsMapList(flowAndStatisticsMapLists.orElse(Collections.emptyList()));
                 logger.debug("Converted flow statistics : {}",message.build().toString());
@@ -228,7 +232,7 @@ public class MultipartReplyTranslator implements IMDMessageTranslator<OfHeader,
                 message.setTransactionId(generateTransactionId(mpReply.getXid()));
                 MultipartReplyGroupCase caseBody = (MultipartReplyGroupCase)mpReply.getMultipartReplyBody();
                 MultipartReplyGroup replyBody = caseBody.getMultipartReplyGroup();
-                final Optional<List<GroupStats>> groupStatsList = ConvertorManager.getInstance().convert(replyBody.getGroupStats());
+                final Optional<List<GroupStats>> groupStatsList = convertorExecutor.convert(replyBody.getGroupStats(), data);
                 message.setGroupStats(groupStatsList.orElse(Collections.emptyList()));
                 logger.debug("Converted group statistics : {}",message.toString());
                 listDataObject.add(message.build());
@@ -244,8 +248,7 @@ public class MultipartReplyTranslator implements IMDMessageTranslator<OfHeader,
                 MultipartReplyGroupDescCase caseBody = (MultipartReplyGroupDescCase)mpReply.getMultipartReplyBody();
                 MultipartReplyGroupDesc replyBody = caseBody.getMultipartReplyGroupDesc();
 
-                final VersionConvertorData data = new VersionConvertorData(sc.getPrimaryConductor().getVersion());
-                final Optional<List<GroupDescStats>> groupDescStatsList = ConvertorManager.getInstance().convert(replyBody.getGroupDesc(), data);
+                final Optional<List<GroupDescStats>> groupDescStatsList = convertorExecutor.convert(replyBody.getGroupDesc(), data);
                 message.setGroupDescStats(groupDescStatsList.orElse(Collections.emptyList()));
                 logger.debug("Converted group statistics : {}",message.toString());
                 listDataObject.add(message.build());
@@ -311,7 +314,7 @@ public class MultipartReplyTranslator implements IMDMessageTranslator<OfHeader,
                 MultipartReplyMeter replyBody = caseBody.getMultipartReplyMeter();
 
                 final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats>> meterStatsList =
-                        ConvertorManager.getInstance().convert(replyBody.getMeterStats());
+                        convertorExecutor.convert(replyBody.getMeterStats(), data);
 
                 message.setMeterStats(meterStatsList.orElse(Collections.emptyList()));
                 listDataObject.add(message.build());
@@ -328,7 +331,7 @@ public class MultipartReplyTranslator implements IMDMessageTranslator<OfHeader,
                 MultipartReplyMeterConfigCase caseBody = (MultipartReplyMeterConfigCase)mpReply.getMultipartReplyBody();
                 MultipartReplyMeterConfig replyBody = caseBody.getMultipartReplyMeterConfig();
 
-                final Optional<List<MeterConfigStats>> meterConfigStatsList = ConvertorManager.getInstance().convert(replyBody.getMeterConfig());
+                final Optional<List<MeterConfigStats>> meterConfigStatsList = convertorExecutor.convert(replyBody.getMeterConfig(), data);
 
                 message.setMeterConfigStats(meterConfigStatsList.orElse(Collections.emptyList()));
                 listDataObject.add(message.build());
index abb3eb79789c5a3a5e0704931e76e3fe39d832ed..a2d4b946a97d7482845a4b0d7de081dbb4c23176 100644 (file)
@@ -18,7 +18,7 @@ import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
 import org.opendaylight.openflowplugin.extension.api.AugmentTuple;
 import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
 import org.opendaylight.openflowplugin.openflow.md.core.extension.MatchExtensionHelper;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
 import org.opendaylight.openflowplugin.openflow.md.util.PacketInUtil;
@@ -43,6 +43,11 @@ public class PacketInTranslator implements IMDMessageTranslator<OfHeader, List<D
 
     private static final Logger LOG = LoggerFactory
             .getLogger(PacketInTranslator.class);
+    private final ConvertorExecutor convertorExecutor;
+
+    public PacketInTranslator(ConvertorExecutor convertorExecutor) {
+        this.convertorExecutor = convertorExecutor;
+    }
 
     @Override
     public List<DataObject> translate(final SwitchConnectionDistinguisher cookie,
@@ -101,7 +106,7 @@ public class PacketInTranslator implements IMDMessageTranslator<OfHeader, List<D
                     datapathIdConvertorData.setDatapathId(dpid);
 
                     final OpenflowVersion ofVersion = OpenflowVersion.get(sc.getPrimaryConductor().getVersion());
-                    final Optional<MatchBuilder> matchOptional = ConvertorManager.getInstance().convert(message.getMatch(), datapathIdConvertorData);
+                    final Optional<MatchBuilder> matchOptional = convertorExecutor.convert(message.getMatch(), datapathIdConvertorData);
                     final MatchBuilder matchBuilder = new MatchBuilder(matchOptional.orElse(new MatchBuilder()).build());
 
                     AugmentTuple<org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.Match> matchExtensionWrap =
index ea3254406a90713d444dc35657d8e7ffb551263f..8eb350f358900cfd1cc51805db5fde840b0b2160 100644 (file)
@@ -42,6 +42,8 @@ import org.opendaylight.openflowplugin.api.openflow.statistics.MessageSpy;
 import org.opendaylight.openflowplugin.openflow.md.core.plan.ConnectionAdapterStackImpl;
 import org.opendaylight.openflowplugin.openflow.md.core.plan.EventFactory;
 import org.opendaylight.openflowplugin.openflow.md.core.plan.SwitchTestEvent;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.queue.QueueProcessorLightImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortFeatures;
@@ -154,7 +156,8 @@ public class ConnectionConductorImplTest {
 
         popListener = new PopListenerCountingImpl<>();
 
-        controller = new MDController();
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        controller = new MDController(convertorManager);
         controller.init();
         controller.getMessageTranslators().putAll(assembleTranslatorMapping());
 
index 7acdb6de9ea44a46f814cafcb205f7216ed0d845..d871ec0fccf8ffb0990733fdb487e4b268d42b11 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.openflowplugin.openflow.md.core;
 
 import java.util.List;
-
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -16,6 +15,8 @@ import org.junit.Test;
 import org.opendaylight.openflowplugin.api.openflow.md.core.IMDMessageTranslator;
 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketIn;
@@ -35,7 +36,8 @@ public class MDControllerTest {
      */
     @Before
     public void setUp() throws Exception {
-        controller = new MDController();
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        controller = new MDController(convertorManager);
         controller.init();
     }
 
@@ -47,12 +49,6 @@ public class MDControllerTest {
         controller = null;
     }
 
-
-    /**
-     * Test method for
-     * {@link org.opendaylight.openflowplugin.openflow.md.core.MDController#addMessageListeners}
-     * .
-     */
     @Test
     public void testAddMessageListeners() {
         //clean translators
index 351c566e1515eaf5888b82113b241d669bfd83f5..ae87f009ef71ca520deb5d1cf27e0ca62252774d 100644 (file)
@@ -43,6 +43,8 @@ import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationEnqueuer
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessionKeyOF;
 import org.opendaylight.openflowplugin.openflow.md.core.ThreadPoolLoggingExecutor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
@@ -60,7 +62,7 @@ public class ConcurrentSalRegistrationManagerTest {
 
     /** registration related action must end within this amount of seconds */
     private static final int REGISTRATION_ACTION_TIMEOUT = 5;
-    protected static final SalRegistrationManager registrationManager = new SalRegistrationManager();
+    protected SalRegistrationManager registrationManager;
     protected static final Logger LOG = LoggerFactory.getLogger(ConcurrentSalRegistrationManagerTest.class);
     protected static final SwitchSessionKeyOF SWITCH_SESSION_KEY_OF = new SwitchSessionKeyOF();
 
@@ -94,6 +96,8 @@ public class ConcurrentSalRegistrationManagerTest {
      */
     @Before
     public void setUp() {
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        registrationManager = new SalRegistrationManager(convertorManager);
         SWITCH_SESSION_KEY_OF.setDatapathId(BigInteger.ONE);
         Mockito.when(context.getNotificationEnqueuer()).thenReturn(notificationEnqueuer);
 
index 34a6fe4411d2d7502c5749a4c63af0306e8464ff..1d551876e736d50a9330c9c81d9303a20bcc637c 100644 (file)
@@ -35,6 +35,8 @@ import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDist
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.IMessageDispatchService;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
 import org.opendaylight.openflowplugin.api.openflow.statistics.MessageSpy;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
@@ -207,8 +209,9 @@ public class ModelDrivenSwitchImplTest {
 
         OpenflowPortsUtil.init();
 
-        mdSwitchOF10 = new ModelDrivenSwitchImpl(null, null, context);
-        mdSwitchOF13 = new ModelDrivenSwitchImpl(null, null, context);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        mdSwitchOF10 = new ModelDrivenSwitchImpl(null, null, context, convertorManager);
+        mdSwitchOF13 = new ModelDrivenSwitchImpl(null, null, context, convertorManager);
     }
 
     /**
index 93324e4a6b685d2dcbf14adf3629bf7efbc42a97..ed51e4e73b66cf4d8e7bd087b14a5d5cd99f318c 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal;
 
 import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.when;
+
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import java.util.Collection;
@@ -26,6 +27,8 @@ import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDist
 import org.opendaylight.openflowplugin.api.openflow.md.core.sal.NotificationComposer;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.IMessageDispatchService;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 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.UpdateFlowOutput;
@@ -53,24 +56,24 @@ public class OFRpcTaskUtilTest {
     @Mock
     private ListenableFuture<RpcResult<UpdateFlowOutput>> updateFlowRpcResultListenableFuture;
     @Mock
-    private OFRpcTaskContext ofRpcTaskContext;
-    @Mock
     private NotificationProviderService notificationProviderService;
     @Mock
     private NotificationComposer<?> notificationComposer;
     @Mock
     ListeningExecutorService executorService;
+    private ConvertorManager convertorManager;
 
 
     @Before
-    public void setup() {
+    public void setUp() {
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
         when(taskContext.getSession()).thenReturn(sessionContext);
         when(taskContext.getMessageService()).thenReturn(messageDispatchService);
         when(sessionContext.getNextXid()).thenReturn(new Long(10));
         when(sessionContext.getFeatures()).thenReturn(featuresOutput);
         when(featuresOutput.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
         when(messageDispatchService.barrier(Mockito.any(BarrierInput.class), Mockito.any(SwitchConnectionDistinguisher.class))).thenReturn(resultListenableFuture);
-        when(ofRpcTaskContext.getRpcPool()).thenReturn(executorService);
+        when(taskContext.getRpcPool()).thenReturn(executorService);
         when(executorService.submit(Mockito.<Callable<RpcResult<UpdateFlowOutput>>> any())).thenReturn(updateFlowRpcResultListenableFuture);
     }
 
@@ -84,7 +87,7 @@ public class OFRpcTaskUtilTest {
     @Test
     public void testHookFutureNotification() throws Exception {
         final AddFlowInputBuilder flowInputBuilder = new AddFlowInputBuilder();
-        final OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> addFlowInputRpcResultOFRpcTask = OFRpcTaskFactory.createAddFlowTask(ofRpcTaskContext, flowInputBuilder.build(), connectionDistinguisher);
+        final OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> addFlowInputRpcResultOFRpcTask = OFRpcTaskFactory.createAddFlowTask(taskContext, flowInputBuilder.build(), connectionDistinguisher, convertorManager);
         OFRpcTaskUtil.hookFutureNotification(addFlowInputRpcResultOFRpcTask, updateFlowRpcResultListenableFuture, notificationProviderService, notificationComposer);
     }
 
@@ -92,7 +95,7 @@ public class OFRpcTaskUtilTest {
     public void testChainFutureBarrier() throws Exception {
         final AddFlowInputBuilder flowInputBuilder = new AddFlowInputBuilder();
         flowInputBuilder.setBarrier(true);
-        final OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> addFlowInputRpcResultOFRpcTask = OFRpcTaskFactory.createAddFlowTask(ofRpcTaskContext, flowInputBuilder.build(), connectionDistinguisher);
+        final OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> addFlowInputRpcResultOFRpcTask = OFRpcTaskFactory.createAddFlowTask(taskContext, flowInputBuilder.build(), connectionDistinguisher, convertorManager);
         OFRpcTaskUtil.chainFutureBarrier(addFlowInputRpcResultOFRpcTask, updateFlowRpcResultListenableFuture);
     }
 }
\ No newline at end of file
index 120107b547a497acf1392c50d58219ff9b039cf5..a1df985628363f5e6fae9c932b9f849d619e50da 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import java.math.BigInteger;
@@ -36,6 +37,8 @@ import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDist
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.IMessageDispatchService;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessionKeyOF;
 import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContextOFImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
@@ -101,9 +104,10 @@ public class SalRegistrationManagerTest {
         Mockito.when(features.getVersion()).thenReturn((short) 1);
         context.setFeatures(features);
         context.setNotificationEnqueuer(notificationEnqueuer);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
 
-       OfEntityManager entManager = new OfEntityManager(entityOwnershipService,getConfig());
-        mdSwitchOF13 = new ModelDrivenSwitchImpl(null, null, context);
+        OfEntityManager entManager = new OfEntityManager(entityOwnershipService,getConfig());
+        mdSwitchOF13 = new ModelDrivenSwitchImpl(null, null, context, convertorManager);
         registration = new AbstractModelDrivenSwitchRegistration(mdSwitchOF13) {
             @Override
             protected void removeRegistration() {
@@ -119,7 +123,7 @@ public class SalRegistrationManagerTest {
                 messageDispatchService.flowMod(Matchers.any(FlowModInput.class),
                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
 
-        salRegistrationManager = new SalRegistrationManager();
+        salRegistrationManager = new SalRegistrationManager(convertorManager);
         salRegistrationManager.setPublishService(notificationProviderService);
         salRegistrationManager.setDataService(dataBroker);
         salRegistrationManager.setRpcProviderRegistry(rpcProviderRegistry);
diff --git a/openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/ConvertorManagerTest.java b/openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/ConvertorManagerTest.java
new file mode 100644 (file)
index 0000000..7675e54
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
+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.yangtools.yang.binding.DataContainer;
+
+/**
+ * Test for {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager}
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ConvertorManagerTest {
+    /**
+     * Test for {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager#registerConvertor(short, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor)}
+     * @throws Exception
+     */
+    @Test
+    public void testRegisterConvertor() throws Exception {
+        final ConvertorManager convertorManager = new ConvertorManager(OFConstants.OFP_VERSION_1_3)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, new Convertor<Action, String, VersionConvertorData>() {
+                    @Override
+                    public Collection<Class<? extends DataContainer>> getTypes() {
+                        return Collections.singleton(Action.class);
+                    }
+
+                    @Override
+                    public String convert(Action source, VersionConvertorData data) {
+                        return null;
+                    }
+                });
+
+        final Optional<Convertor> convertor = convertorManager.findConvertor(OFConstants.OFP_VERSION_1_3, Action.class);
+        assertTrue("Failed to find convertor for action", convertor.isPresent());
+    }
+
+    /**
+     * Test for {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager#convert(org.opendaylight.yangtools.yang.binding.DataContainer, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData)}
+     * @throws Exception
+     */
+    @Test
+    public void testConvert() throws Exception {
+        final ConvertorManager convertorManager = new ConvertorManager(OFConstants.OFP_VERSION_1_3)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, new Convertor<Action, String, VersionConvertorData>() {
+                    @Override
+                    public Collection<Class<? extends DataContainer>> getTypes() {
+                        return Collections.singleton(Action.class);
+                    }
+
+                    @Override
+                    public String convert(Action source, VersionConvertorData data) {
+                        return String.valueOf(source) + String.valueOf(data);
+                    }
+                });
+
+        final Action source = new ActionBuilder().build();
+        final VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
+        final String expectedResult = String.valueOf(source) + String.valueOf(data);
+        final Optional<String> result = convertorManager.convert(source, data);
+
+        assertTrue("Failed to convert action to string", result.isPresent());
+        assertEquals("Result and expected result do not match", result.get(), expectedResult);
+    }
+
+    /**
+     * Test for {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager#convert(java.util.Collection, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorData)}
+     * @throws Exception
+     */
+    @Test
+    public void testConvert1() throws Exception {
+        final ConvertorManager convertorManager = new ConvertorManager(OFConstants.OFP_VERSION_1_3)
+                .registerConvertor(OFConstants.OFP_VERSION_1_3, new Convertor<List<Action>, String, VersionConvertorData>() {
+                    @Override
+                    public Collection<Class<? extends DataContainer>> getTypes() {
+                        return Collections.singleton(Action.class);
+                    }
+
+                    @Override
+                    public String convert(List<Action> source, VersionConvertorData data) {
+                        return String.valueOf(source) + String.valueOf(data);
+                    }
+                });
+
+        final List<Action> source = Collections.singletonList(new ActionBuilder().build());
+        final VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
+        final String expectedResult = String.valueOf(source) + String.valueOf(data);
+        final Optional<String> result = convertorManager.convert(source, data);
+
+        assertTrue("Failed to convert action to string", result.isPresent());
+        assertEquals("Result and expected result do not match", result.get(), expectedResult);
+    }
+}
\ No newline at end of file
index 778e87e5d5951264673af4dd5b7bcd3bc0c735c1..92acc97320cbba66dcf4f66b28928d1c012668c7 100644 (file)
@@ -13,6 +13,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
@@ -47,6 +48,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList;
 
 public class GroupConvertorTest {
+    private ConvertorManager convertorManager;
+
+    @Before
+    public void setUp() {
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
+    }
 
     /**
      * test of {@link GroupConvertor#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)} }
@@ -510,7 +517,7 @@ public class GroupConvertorTest {
     }
 
     private GroupModInputBuilder convert(Group group, VersionDatapathIdConvertorData data) {
-        final Optional<GroupModInputBuilder> outAddGroupInputOptional = ConvertorManager.getInstance().convert(group, data);
+        final Optional<GroupModInputBuilder> outAddGroupInputOptional = convertorManager.convert(group, data);
         Assert.assertTrue("Group convertor not found", outAddGroupInputOptional.isPresent());
         return outAddGroupInputOptional.get();
     }
index 79628fd2db13dbf45449d37cbd35087d6c01ceec..7bff29521c9019ca85cf6c53f9f48e93bc878afb 100644 (file)
@@ -13,6 +13,7 @@ import java.util.Collections;
 import java.util.List;\r
 import java.util.Optional;\r
 import org.junit.Assert;\r
+import org.junit.Before;\r
 import org.junit.Test;\r
 import org.opendaylight.openflowplugin.api.OFConstants;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;\r
@@ -38,6 +39,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  *\r
  */\r
 public class GroupDescStatsResponseConvertorTest {\r
+    private ConvertorManager convertorManager;\r
+\r
+    @Before\r
+    public void setUp() {\r
+        convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+    }\r
 \r
     /**\r
      * Test empty GroupDescStats conversion\r
@@ -236,7 +243,7 @@ public class GroupDescStatsResponseConvertorTest {
     }\r
 \r
     private List<GroupDescStats> convert(List<GroupDesc> groupDescStats,VersionConvertorData data) {\r
-        Optional<List<GroupDescStats>> statsListOptional = ConvertorManager.getInstance().convert(groupDescStats, data);\r
+        Optional<List<GroupDescStats>> statsListOptional = convertorManager.convert(groupDescStats, data);\r
         return  statsListOptional.orElse(Collections.emptyList());\r
     }\r
 }\r
index 64531a5320c147f37e0c0197d07f55fdd18030a2..c0d570058577f6403a69476879ef03bad3eb9384 100644 (file)
@@ -14,7 +14,10 @@ import java.util.List;
 \r
 import java.util.Optional;\r
 import org.junit.Assert;\r
+import org.junit.Before;\r
 import org.junit.Test;\r
+import org.opendaylight.openflowplugin.api.OFConstants;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.buckets.BucketCounter;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStats;\r
@@ -27,6 +30,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  *\r
  */\r
 public class GroupStatsResponseConvertorTest {\r
+    private ConvertorManager convertorManager;\r
+\r
+    @Before\r
+    public void setUp() {\r
+        convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+    }\r
 \r
     /**\r
      * Test empty GroupStats conversion\r
@@ -36,7 +45,7 @@ public class GroupStatsResponseConvertorTest {
         List<GroupStats> groupStats = new ArrayList<>();\r
 \r
         Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
-                .GroupStats>> salGroupStats = ConvertorManager.getInstance().convert(groupStats);\r
+                .GroupStats>> salGroupStats = convertorManager.convert(groupStats, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));\r
 \r
         Assert.assertFalse("Group stats response should be not present", salGroupStats.isPresent());\r
     }\r
@@ -58,7 +67,7 @@ public class GroupStatsResponseConvertorTest {
         groupStats.add(statsBuilder.build());\r
 \r
         Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
-                .GroupStats>> salGroupStatsOptional = ConvertorManager.getInstance().convert(groupStats);\r
+                .GroupStats>> salGroupStatsOptional = convertorManager.convert(groupStats, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));\r
         Assert.assertTrue("Group stats response convertor not found", salGroupStatsOptional.isPresent());\r
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
                 .GroupStats> salGroupStats = salGroupStatsOptional.get();\r
@@ -101,7 +110,7 @@ public class GroupStatsResponseConvertorTest {
         groupStats.add(statsBuilder.build());\r
 \r
         Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
-                .GroupStats>> salGroupStatsOptional = ConvertorManager.getInstance().convert(groupStats);\r
+                .GroupStats>> salGroupStatsOptional = convertorManager.convert(groupStats, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));\r
         Assert.assertTrue("Group stats response convertor not found", salGroupStatsOptional.isPresent());\r
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
                 .GroupStats> salGroupStats = salGroupStatsOptional.get();\r
@@ -154,7 +163,7 @@ public class GroupStatsResponseConvertorTest {
         groupStats.add(statsBuilder.build());\r
 \r
         Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
-                .GroupStats>> salGroupStatsOptional = ConvertorManager.getInstance().convert(groupStats);\r
+                .GroupStats>> salGroupStatsOptional = convertorManager.convert(groupStats, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));\r
         Assert.assertTrue("Group stats response convertor not found", salGroupStatsOptional.isPresent());\r
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply\r
                 .GroupStats> salGroupStats = salGroupStatsOptional.get();\r
index 4bb1cd3a762079366faed8d3c38c4ced863907fc..93608292c914111c3b6e4ea88ec1f0e7e68a3ab9 100644 (file)
@@ -17,6 +17,8 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import org.junit.Test;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.config.stats.reply.MeterConfigStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId;
@@ -74,7 +76,8 @@ public class MeterConfigStatsResponseConvertorTest {
      * Test of basic mapping functionality of {@link MeterConfigStatsResponseConvertor#convert(java.util.List)} }
      */
     public void testToSALMeterConfigList() {
-        Optional<List<MeterConfigStats>> meterConfigsOptional = ConvertorManager.getInstance().convert(createMeterConfigList());
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        Optional<List<MeterConfigStats>> meterConfigsOptional = convertorManager.convert(createMeterConfigList(), new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
         List<MeterConfigStats> meterConfigs = meterConfigsOptional.orElse(Collections.emptyList());
 
         assertEquals(PRESET_COUNT, meterConfigs.size());
index 1ba7d917269476e029e88f5cf49ea06b5fec4337..dd4add67d1d588c2f03e89fb35d192e6520ec992 100644 (file)
@@ -14,6 +14,7 @@ import static org.junit.Assert.assertTrue;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
+import org.junit.Before;
 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;
@@ -42,6 +43,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.mod.Bands;
 
 public class MeterConvertorTest {
+    private ConvertorManager convertorManager;
+
+    @Before
+    public void setUp() {
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
+    }
+
     @Test
     public void testMeterModCommandConvertorwithAllParameters() {
         long BURST_SIZE = 10L;
@@ -449,7 +457,7 @@ public class MeterConvertorTest {
     }
 
     private MeterModInputBuilder convert(Meter source, VersionConvertorData data) {
-        Optional<MeterModInputBuilder> outMeterModInputOptional = ConvertorManager.getInstance().convert(source, data);
+        Optional<MeterModInputBuilder> outMeterModInputOptional = convertorManager.convert(source, data);
         return outMeterModInputOptional.orElse(MeterConvertor.defaultResult(data.getVersion()));
     }
 }
\ No newline at end of file
index 16b9871ad339adc2a7f91bd42a8dfca04df26d1a..33db1c193729947b92233d726833e99b0e34dcd8 100644 (file)
@@ -16,6 +16,8 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import org.junit.Test;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.meter.band.stats.BandStat;
 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.MeterStatsKey;
@@ -61,8 +63,8 @@ public class MeterStatsResponseConvertorTest {
      * Test of basic mapping functionality of {@link MeterStatsResponseConvertor#convert(java.util.List)}
      */
     public void testToSALMeterStatsList() {
-
-        Optional<List<MeterStats>> meterStatsListOptional = ConvertorManager.getInstance().convert(createMeterStatsLit());
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        Optional<List<MeterStats>> meterStatsListOptional = convertorManager.convert(createMeterStatsLit(), new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
         List<MeterStats> meterStatsList = meterStatsListOptional.orElse(Collections.emptyList());
         assertEquals(PRESET_COUNT, meterStatsList.size());
 
index cce8c34e94fc046b575d20986d58bdd77347ecbc..ca5909d6935bb6eb6a74c8a965bd0190a23f7a1c 100644 (file)
@@ -52,9 +52,12 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 \r
 public class PacketOutConvertorTest {\r
 \r
+    private ConvertorManager convertorManager;\r
+\r
     @Before\r
-    public void init() {\r
+    public void setUp() {\r
         OpenflowPortsUtil.init();\r
+        convertorManager = ConvertorManagerFactory.createDefaultManager();\r
     }\r
 \r
     /**\r
@@ -182,7 +185,7 @@ public class PacketOutConvertorTest {
         ActionConvertorData actionConvertorData = new ActionConvertorData(version);\r
         actionConvertorData.setDatapathId(datapathId);\r
 \r
-        Optional<List<Action>> actionsOptional = ConvertorManager.getInstance().convert(\r
+        Optional<List<Action>> actionsOptional = convertorManager.convert(\r
                 actionList, actionConvertorData);\r
 \r
         List<Action> actions = actionsOptional.orElse(Collections.emptyList());\r
@@ -282,7 +285,7 @@ public class PacketOutConvertorTest {
     }\r
 \r
     private PacketOutInput convert(TransmitPacketInput transmitPacketInput, PacketOutConvertorData data) {\r
-        Optional<PacketOutInput> messageOptional = ConvertorManager.getInstance().convert(transmitPacketInput, data);\r
+        Optional<PacketOutInput> messageOptional = convertorManager.convert(transmitPacketInput, data);\r
         return messageOptional.orElse(PacketOutConvertor.defaultResult(data.getVersion()));\r
     }\r
 }\r
index 6cedb3d7410db1372f8fda81ac41f03225b467ee..98a3adaf94611769c269e9a8ea80618993569424 100644 (file)
@@ -61,7 +61,8 @@ public class PortConvertorTest {
         portBld.setHardwareAddress(new MacAddress(DEFAULT_MAC_ADDRESS));
 
         VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
-        Optional<PortModInput> portOutOptional = ConvertorManager.getInstance().convert(portBld.build(), data);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        Optional<PortModInput> portOutOptional = convertorManager.convert(portBld.build(), data);
         PortModInput portOut = portOutOptional.orElse(PortConvertor.defaultResult(OFConstants.OFP_VERSION_1_3));
 
         PortConfigV10 portConfV10 = new PortConfigV10(false, false, false, false, true, true, false);
index 4b2f64f5ed6bea7dbe3cd1dabe3a4098664c5c70..720f98d163b20c3c6512c27516b63353a162b5cf 100644 (file)
@@ -8,6 +8,9 @@
 
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -16,11 +19,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Optional;
-import junit.framework.TestCase;
 import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCaseBuilder;
@@ -84,8 +86,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.table.properties.TableFeatureProperties;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder;
 
-@RunWith(MockitoJUnitRunner.class)
-public class TableFeaturesConvertorTest extends TestCase {
+public class TableFeaturesConvertorTest {
     private static final TablePropertiesBuilder tablePropertiesBuilder = new TablePropertiesBuilder();
     private static final Map<Class<? extends TableFeaturePropType>, TableFeaturePropType> augmentationsMap = new HashMap<>();
     private static final List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction> instructionsList = new ArrayList<>();
@@ -334,8 +335,10 @@ public class TableFeaturesConvertorTest extends TestCase {
                 .setTableFeatures(tableFeaturesList)
                 .build();
 
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+
         Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures>> tableFeaturesesOptional =
-                ConvertorManager.getInstance().convert(tableFeatures);
+                convertorManager.convert(tableFeatures, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
 
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures> tableFeatureses =
                 tableFeaturesesOptional.orElse(Collections.emptyList());
index 6a026fe468479c3da7dca0f30a75d2f4a6c6e630..68656a440e9f90ad466f989f7ed089a4a4030032 100644 (file)
@@ -14,8 +14,11 @@ import java.util.Collections;
 import java.util.List;\r
 import java.util.Optional;\r
 import org.junit.Assert;\r
+import org.junit.Before;\r
 import org.junit.Test;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;\r
+import org.opendaylight.openflowplugin.api.OFConstants;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeatureProperty;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeaturePropertyBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeatureProperty;\r
@@ -107,6 +110,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table
  * @author michal.polkorab\r
  */\r
 public class TableFeaturesResponseConvertorTest {\r
+    private ConvertorManager convertorManager;\r
+\r
+    @Before\r
+    public void setUp() {\r
+        convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+    }\r
 \r
     /**\r
      * Incorrect / empty input test\r
@@ -787,7 +796,7 @@ public class TableFeaturesResponseConvertorTest {
 \r
 \r
     private List<TableFeatures> convert(MultipartReplyTableFeatures features) {\r
-        Optional<List<TableFeatures>> listOptional = ConvertorManager.getInstance().convert(features);\r
+        Optional<List<TableFeatures>> listOptional = convertorManager.convert(features, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));\r
         return listOptional.orElse(Collections.emptyList());\r
     }\r
 }
\ No newline at end of file
index 73ef034c00f4f17c2bd844d3ddd0aaa0fd95c780..99a847487e386e56c62eeeed32cf4e65fd757415 100644 (file)
@@ -16,6 +16,7 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
@@ -107,9 +108,10 @@ public class ActionConvertorTest {
 
         ActionConvertorData data = new ActionConvertorData((short) 0X4);
         data.setDatapathId(BigInteger.ONE);
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
 
         Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action>> OFActionsList =
-                ConvertorManager.getInstance().convert(actions, data);
+                convertorManager.convert(actions, data);
 
         outputActions(OFActionsList.orElse(Collections.emptyList()));
 
@@ -208,7 +210,6 @@ public class ActionConvertorTest {
 
             }
             if (action.getActionChoice() instanceof CopyTtlInCase) {
-                CopyTtlInCase copyTtlInCase = (CopyTtlInCase) action.getActionChoice();
                 Assert.assertEquals(action.getActionChoice().getImplementedInterface().getName(), CopyTtlInCase.class.getName());
 
             }
index 2a84783aa471713f13025020a3a5d8ea83da39b1..f88207c7b2d78cda2b4e3b3c3c7aa56b6f3de8f3 100644 (file)
@@ -14,10 +14,12 @@ import java.util.Collections;
 import java.util.List;\r
 import java.util.Optional;\r
 import org.junit.Assert;\r
+import org.junit.Before;\r
 import org.junit.Test;\r
 import org.opendaylight.openflowplugin.api.OFConstants;\r
 import org.opendaylight.openflowplugin.extension.api.path.ActionPath;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertorUtil;\r
@@ -78,6 +80,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
  *\r
  */\r
 public class ActionConvertorV10Test {\r
+    private ConvertorManager convertorManager;\r
+\r
+    @Before\r
+    public void setUp() {\r
+        convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+    }\r
 \r
     /**\r
      * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData)}}\r
@@ -206,7 +214,7 @@ public class ActionConvertorV10Test {
         data.setIpProtocol(FlowConvertorUtil.getIpProtocolFromFlow(flow));\r
 \r
         Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action>> actionsOptional =\r
-                ConvertorManager.getInstance().convert(salActions, data);\r
+                convertorManager.convert(salActions, data);\r
 \r
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actions = actionsOptional.orElse(Collections.emptyList());\r
         \r
@@ -305,7 +313,7 @@ public class ActionConvertorV10Test {
 \r
         Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
         .Action>> mdSalActionsOptional =\r
-                ConvertorManager.getInstance().convert(\r
+                convertorManager.convert(\r
                         actions, data);\r
 \r
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
index a26e3bc684dbe9dc67db85ec3428168bb5b218c3..fc6839fbc8aa1f3afacd1c0df6652af44227cf14 100644 (file)
@@ -14,10 +14,12 @@ import java.util.Collections;
 import java.util.List;\r
 import java.util.Optional;\r
 import org.junit.Assert;\r
+import org.junit.Before;\r
 import org.junit.Test;\r
 import org.opendaylight.openflowplugin.api.OFConstants;\r
 import org.opendaylight.openflowplugin.extension.api.path.ActionPath;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertorUtil;\r
@@ -118,6 +120,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.matc
  * @author michal.polkorab\r
  */\r
 public class ActionConvertorV13Test {\r
+    private ConvertorManager convertorManager;\r
+\r
+    @Before\r
+    public void setUp() {\r
+        convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+    }\r
+\r
     /**\r
      * Test {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionResponseConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData)}}\r
      */\r
@@ -128,7 +137,7 @@ public class ActionConvertorV13Test {
         data.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);\r
 \r
         Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
-                .Action>> mdSalActions = ConvertorManager.getInstance().convert(actions, data);\r
+                .Action>> mdSalActions = convertorManager.convert(actions, data);\r
 \r
         Assert.assertEquals("Wrong number of output actions", 0, mdSalActions.orElse(Collections.emptyList()).size());\r
     }\r
@@ -269,7 +278,7 @@ public class ActionConvertorV13Test {
         data.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);\r
 \r
         Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
-                .Action>> mdSalActionsOptional = ConvertorManager.getInstance().convert(actions, data);\r
+                .Action>> mdSalActionsOptional = convertorManager.convert(actions, data);\r
 \r
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action\r
                 .Action> mdSalActions = mdSalActionsOptional.orElse(Collections.emptyList());\r
@@ -502,7 +511,7 @@ public class ActionConvertorV13Test {
         data.setDatapathId(new BigInteger("42"));\r
         data.setIpProtocol(FlowConvertorUtil.getIpProtocolFromFlow(flow));\r
 \r
-        Optional<List<Action>> actionsOptional = ConvertorManager.getInstance().convert(salActions, data);\r
+        Optional<List<Action>> actionsOptional = convertorManager.convert(salActions, data);\r
         List<Action> actions = actionsOptional.orElse(Collections.emptyList());\r
 \r
         Assert.assertEquals("Wrong number of actions", 12, actions.size());\r
index 5cf33ef4091c4811486365c494b861e7230896a2..45ac82c9d61013cf1311863d8b0dc1d742d5d336 100644 (file)
@@ -14,9 +14,11 @@ import java.util.Collections;
 import java.util.List;\r
 import java.util.Optional;\r
 import org.junit.Assert;\r
+import org.junit.Before;\r
 import org.junit.Test;\r
 import org.opendaylight.openflowplugin.api.OFConstants;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder;\r
@@ -74,6 +76,12 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
  *\r
  */\r
 public class FlowConvertorTest {\r
+    private ConvertorManager convertorManager;\r
+\r
+    @Before\r
+    public void setUp() {\r
+        convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+    }\r
 \r
     /**\r
      * Tests {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.flow.FlowConvertor#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)} }\r
@@ -264,7 +272,7 @@ public class FlowConvertorTest {
     }\r
 \r
     private List<FlowModInputBuilder> convert(Flow flow, VersionDatapathIdConvertorData data) {\r
-        Optional<List<FlowModInputBuilder>> flowModOptional = ConvertorManager.getInstance().convert(flow, data);\r
+        Optional<List<FlowModInputBuilder>> flowModOptional = convertorManager.convert(flow, data);\r
         Assert.assertTrue("Flow convertor not found", flowModOptional.isPresent());\r
         return flowModOptional.get();\r
     }\r
index 1081f6df13fdf742f4b667ecd0bca4206e492c75..11003c9c0f0088d3735b746836c90c534121f1df 100644 (file)
@@ -16,9 +16,11 @@ import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
+import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
@@ -42,23 +44,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
  * Created by Martin Bobak mbobak@cisco.com on 9/18/14.
  */
 public class FlowStatsResponseConvertorTest {
+    private ConvertorManager convertorManager;
 
-    private static final int PRESET_COUNT = 7;
-
-    /**
-     * Test method for {@link FlowStatsResponseConvertor#wrapOF10ActionsToInstruction(java.util.List, short)} }
-     */
-    @Test
-    public void testWrapOF10ActionsToInstruction() {
-        ActionBuilder actionBuilder = new ActionBuilder();
-        List<Action> actions = new ArrayList<>();
-        for (int j = 0; j < PRESET_COUNT; j++) {
-            actions.add(actionBuilder.build());
-        }
-        Instructions instructions = FlowStatsResponseConvertor.wrapOF10ActionsToInstruction(actions, OFConstants.OFP_VERSION_1_3);
-        assertNotNull(instructions);
+    @Before
+    public void setUp() {
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
     }
 
+    private static final int PRESET_COUNT = 7;
+
     /**
      * Test method for {@link FlowInstructionResponseConvertor#convert(java.util.List, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData)} }
      */
@@ -165,7 +159,7 @@ public class FlowStatsResponseConvertorTest {
     }
 
     private Instructions convert(List<Instruction> instructionsList, VersionConvertorData data) {
-        Optional<Instructions> instructionsOptional = ConvertorManager.getInstance().convert(instructionsList, data);
+        Optional<Instructions> instructionsOptional = convertorManager.convert(instructionsList, data);
         assertTrue("Flow instruction response convertor not found", instructionsOptional.isPresent());
         return instructionsOptional.get();
     }
index fe3f5d7ea5bf3862f129757d971fa9c241cefffd..ee16c765e577cc13827b70a22ff02dbd534b72d1 100644 (file)
@@ -11,6 +11,8 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
 
@@ -20,6 +22,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 public class FlowFlagReactorTest {
 
     private FlowModFlags[] flowFlags;
+    private ConvertorManager convertorManager;
 
     /**
      * prepare input match
@@ -31,6 +34,7 @@ public class FlowFlagReactorTest {
                 new FlowModFlags(false, false, false, false, false),
                 new FlowModFlags(true, false, true, false, true)
         };
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
     }
 
     /**
@@ -42,7 +46,7 @@ public class FlowFlagReactorTest {
         for (FlowModFlags fFlag : flowFlags) {
             target.setFlags(null);
             FlowFlagReactor.getInstance().convert(fFlag,
-                    OFConstants.OFP_VERSION_1_3, target);
+                    OFConstants.OFP_VERSION_1_3, target, convertorManager);
             Assert.assertNotNull(target.getFlags());
         }
     }
@@ -56,7 +60,7 @@ public class FlowFlagReactorTest {
         for (FlowModFlags fFlag : flowFlags) {
             target.setFlagsV10(null);
             FlowFlagReactor.getInstance().convert(fFlag,
-                    OFConstants.OFP_VERSION_1_0, target);
+                    OFConstants.OFP_VERSION_1_0, target, convertorManager);
             Assert.assertNotNull(target.getFlagsV10());
         }
     }
index edaac8a445e37316c8827e916c7c3aead6c51fa1..184012c13c3fb8101630afc0b069cf1a85248d2f 100644 (file)
@@ -13,7 +13,8 @@ import java.util.List;
 import org.junit.Assert;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;\r
@@ -147,6 +148,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.matc
 public class MatchConvertorImpl2Test {\r
 \r
     private static final MatchConvertorImpl convertor = new MatchConvertorImpl();\r
+    private ConvertorManager convertorManager;\r
 \r
     /**\r
      * Initializes OpenflowPortsUtil\r
@@ -154,26 +156,21 @@ public class MatchConvertorImpl2Test {
     @Before\r
     public void startUp() {\r
         OpenflowPortsUtil.init();\r
+        convertorManager = ConvertorManagerFactory.createDefaultManager();\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testEmptyAndNullInput() {\r
         MatchBuilder builder = new MatchBuilder();\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(null);\r
+        List<MatchEntry> entries = convertor.convert(null, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 0, entries.size());\r
 \r
-        entries = convertor.convert(match);\r
+        entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 0, entries.size());\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testConversion() {\r
         MatchBuilder builder = new MatchBuilder();\r
@@ -234,7 +231,7 @@ public class MatchConvertorImpl2Test {
         builder.setLayer3Match(ipv4MatchBuilder.build());\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(match);\r
+        List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 24, entries.size());\r
         MatchEntry entry = entries.get(0);\r
         checkEntryHeader(entry, InPort.class, false);\r
@@ -343,9 +340,6 @@ public class MatchConvertorImpl2Test {
         Assert.assertEquals("Wrong hasMask", hasMask, entry.isHasMask());\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testIpv4MatchArbitraryBitMaskwithNoMask(){\r
         MatchBuilder builder = new MatchBuilder();\r
@@ -355,7 +349,7 @@ public class MatchConvertorImpl2Test {
         builder.setLayer3Match(ipv4MatchArbitraryBitMaskBuilder.build());\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(match);\r
+        List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 2, entries.size());\r
 \r
         MatchEntry entry = entries.get(0);\r
@@ -366,9 +360,6 @@ public class MatchConvertorImpl2Test {
         Assert.assertEquals("wrong Ipv4Address destination", "10.1.1.1",((Ipv4DstCase) entry.getMatchEntryValue()).getIpv4Dst().getIpv4Address().getValue());\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testIpv4MatchArbitraryBitMaskwithMask(){\r
         MatchBuilder builder = new MatchBuilder();\r
@@ -380,7 +371,7 @@ public class MatchConvertorImpl2Test {
         builder.setLayer3Match(ipv4MatchArbitraryBitMaskBuilder.build());\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(match);\r
+        List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 2, entries.size());\r
 \r
         MatchEntry entry = entries.get(0);\r
@@ -391,9 +382,6 @@ public class MatchConvertorImpl2Test {
         Assert.assertEquals("wrong Ipv4Adress destination", "10.1.1.1",((Ipv4DstCase) entry.getMatchEntryValue()).getIpv4Dst().getIpv4Address().getValue());\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testUdpMatchConversion() {\r
         MatchBuilder builder = new MatchBuilder();\r
@@ -403,7 +391,7 @@ public class MatchConvertorImpl2Test {
         builder.setLayer4Match(udpMatchBuilder.build());\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(match);\r
+        List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 2, entries.size());\r
         MatchEntry entry = entries.get(0);\r
         checkEntryHeader(entry, UdpSrc.class, false);\r
@@ -415,9 +403,6 @@ public class MatchConvertorImpl2Test {
                 .getUdpDst().getPort().getValue().intValue());\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testTunnelIpv4MatchConversion() {\r
         MatchBuilder builder = new MatchBuilder();\r
@@ -427,7 +412,7 @@ public class MatchConvertorImpl2Test {
         builder.setLayer3Match(tunnelIpv4MatchBuilder.build());\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(match);\r
+        List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 2, entries.size());\r
         MatchEntry entry = entries.get(0);\r
         checkEntryHeader(entry, Ipv4Src.class, false);\r
@@ -439,9 +424,6 @@ public class MatchConvertorImpl2Test {
                 .getIpv4Address().getValue());\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testSctpMatchConversion() {\r
         MatchBuilder builder = new MatchBuilder();\r
@@ -451,7 +433,7 @@ public class MatchConvertorImpl2Test {
         builder.setLayer4Match(sctpMatchBuilder.build());\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(match);\r
+        List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 2, entries.size());\r
         MatchEntry entry = entries.get(0);\r
         checkEntryHeader(entry, SctpSrc.class, false);\r
@@ -463,9 +445,6 @@ public class MatchConvertorImpl2Test {
                 .getSctpDst().getPort().getValue().intValue());\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testArpMatchConversion() {\r
         MatchBuilder builder = new MatchBuilder();\r
@@ -482,7 +461,7 @@ public class MatchConvertorImpl2Test {
         builder.setLayer3Match(arpBuilder.build());\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(match);\r
+        List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 5, entries.size());\r
         MatchEntry entry = entries.get(0);\r
         checkEntryHeader(entry, ArpOp.class, false);\r
@@ -506,9 +485,6 @@ public class MatchConvertorImpl2Test {
                 .getArpTha().getMacAddress().getValue());\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testArpMatchConversionWithMasks() {\r
         MatchBuilder builder = new MatchBuilder();\r
@@ -527,7 +503,7 @@ public class MatchConvertorImpl2Test {
         builder.setLayer3Match(arpBuilder.build());\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(match);\r
+        List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 4, entries.size());\r
         MatchEntry entry = entries.get(0);\r
         entry = entries.get(0);\r
@@ -556,9 +532,6 @@ public class MatchConvertorImpl2Test {
                 ((ArpThaCase) entry.getMatchEntryValue()).getArpTha().getMask());\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testIpv6MatchConversion() {\r
         MatchBuilder builder = new MatchBuilder();\r
@@ -577,7 +550,7 @@ public class MatchConvertorImpl2Test {
         builder.setLayer3Match(ipv6Builder.build());\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(match);\r
+        List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 7, entries.size());\r
         MatchEntry entry = entries.get(0);\r
         /* Due to conversion ambiguities, we always get "has mask" because \r
@@ -612,9 +585,6 @@ public class MatchConvertorImpl2Test {
                 true, false, true, false), ((Ipv6ExthdrCase) entry.getMatchEntryValue()).getIpv6Exthdr().getPseudoField());\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testIpv6MatchConversionWithMasks() {\r
         MatchBuilder builder = new MatchBuilder();\r
@@ -624,7 +594,7 @@ public class MatchConvertorImpl2Test {
         builder.setLayer3Match(ipv6Builder.build());\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(match);\r
+        List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 2, entries.size());\r
         MatchEntry entry = entries.get(0);\r
         checkEntryHeader(entry, Ipv6Src.class, true);\r
@@ -641,9 +611,6 @@ public class MatchConvertorImpl2Test {
                 ((Ipv6DstCase) entry.getMatchEntryValue()).getIpv6Dst().getMask());\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testIpv6ExtHeaderConversion() {\r
         MatchBuilder builder = new MatchBuilder();\r
@@ -655,7 +622,7 @@ public class MatchConvertorImpl2Test {
         builder.setLayer3Match(ipv6Builder.build());\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(match);\r
+        List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 1, entries.size());\r
         MatchEntry entry = entries.get(0);\r
         checkEntryHeader(entry, Ipv6Exthdr.class, true);\r
@@ -665,9 +632,6 @@ public class MatchConvertorImpl2Test {
                 ((Ipv6ExthdrCase) entry.getMatchEntryValue()).getIpv6Exthdr().getMask());\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testConversionWithMasks() {\r
         MatchBuilder builder = new MatchBuilder();\r
@@ -707,7 +671,7 @@ public class MatchConvertorImpl2Test {
         builder.setLayer3Match(ipv4MatchBuilder.build());\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(match);\r
+        List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 8, entries.size());\r
         MatchEntry entry = entries.get(0);\r
         checkEntryHeader(entry, Metadata.class, true);\r
@@ -761,9 +725,6 @@ public class MatchConvertorImpl2Test {
                 ((TunnelIdCase) entry.getMatchEntryValue()).getTunnelId().getMask());\r
     }\r
 \r
-    /**\r
-     * Test {@link Convertor#convert(Object)}\r
-     */\r
     @Test\r
     public void testIpv6MatchArbitraryBitMask(){\r
         MatchBuilder builder = new MatchBuilder();\r
@@ -775,7 +736,7 @@ public class MatchConvertorImpl2Test {
         builder.setLayer3Match(ipv6MatchArbitraryBitMaskBuilder.build());\r
         Match match = builder.build();\r
 \r
-        List<MatchEntry> entries = convertor.convert(match);\r
+        List<MatchEntry> entries = convertor.convert(match, convertorManager);\r
         Assert.assertEquals("Wrong entries size", 2, entries.size());\r
 \r
         MatchEntry entry = entries.get(0);\r
index f454f4de004b906415773d67710c47de5205a7c2..639d6f31c11c51fb725b95da7307f3f483e13339 100644 (file)
@@ -9,9 +9,12 @@
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
 
 import static org.junit.Assert.assertEquals;
+
 import java.math.BigInteger;
 import org.junit.Before;
 import org.junit.Test;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpVersion;
@@ -57,10 +60,12 @@ public class MatchConvertorV10ImplTest {
     private static final VlanId DEFAULT_VLAN_ID = new VlanId(42);
     private static final Ipv4Address DEFAULT_IPV4_ADDRESS = new Ipv4Address("10.0.0.1");
     private static final short DEFAULT_MASK = 24;
+    private ConvertorManager convertorManager;
 
     @Before
     public void setup() {
         OpenflowPortsUtil.init();
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
     }
 
     @Test
@@ -68,7 +73,7 @@ public class MatchConvertorV10ImplTest {
      * Test method for {@link MatchConvertorV10Impl#convert(Match,BigInteger)}
      */
     public void testConvert() {
-        MatchV10 matchV10 = matchConvertorV10.convert(createL4UdpMatch().build());
+        MatchV10 matchV10 = matchConvertorV10.convert(createL4UdpMatch().build(), null);
 
         assertEquals(ZERO_MAC, matchV10.getDlDst());
         assertEquals(FF_MAC, matchV10.getDlSrc());
@@ -83,24 +88,24 @@ public class MatchConvertorV10ImplTest {
         assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpSrc().intValue());
         assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpDst().intValue());
 
-        matchV10 = matchConvertorV10.convert(createL4TcpMatch().build());
+        matchV10 = matchConvertorV10.convert(createL4TcpMatch().build(), null);
         assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpSrc().intValue());
         assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpDst().intValue());
 
-        matchV10 = matchConvertorV10.convert(createVlanTcpMatch().build());
+        matchV10 = matchConvertorV10.convert(createVlanTcpMatch().build(), null);
         assertEquals(DEFAULT_VLAN_ID.getValue().intValue(), matchV10.getDlVlan().intValue());
 
     }
 
     /**
      * ICMPv4 match test for
-     * {@link MatchConvertorV10Impl#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match)}.
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor#convert(Object, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor)}.
      */
     @Test
     public void testConvertIcmpv4() {
         MatchBuilder matchBuilder = createMatchBuilderWithDefaults();
         Match match = matchBuilder.build();
-        MatchV10 matchV10 = matchConvertorV10.convert(match);
+        MatchV10 matchV10 = matchConvertorV10.convert(match, convertorManager);
         Integer zero = 0;
         boolean wcTpSrc = true;
         boolean wcTpDst = true;
@@ -131,7 +136,7 @@ public class MatchConvertorV10ImplTest {
             wcTpDst, wcTpSrc);
         match = matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build()).
             build();
-        matchV10 = matchConvertorV10.convert(match);
+        matchV10 = matchConvertorV10.convert(match, convertorManager);
         assertEquals(ZERO_MAC, matchV10.getDlDst());
         assertEquals(FF_MAC, matchV10.getDlSrc());
         assertEquals(0, matchV10.getDlType().intValue());
@@ -157,7 +162,7 @@ public class MatchConvertorV10ImplTest {
             wcTpDst, wcTpSrc);
         match = matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build()).
             build();
-        matchV10 = matchConvertorV10.convert(match);
+        matchV10 = matchConvertorV10.convert(match, convertorManager);
         assertEquals(ZERO_MAC, matchV10.getDlDst());
         assertEquals(FF_MAC, matchV10.getDlSrc());
         assertEquals(0, matchV10.getDlType().intValue());
@@ -185,7 +190,7 @@ public class MatchConvertorV10ImplTest {
             wcTpDst, wcTpSrc);
         match = matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build()).
             build();
-        matchV10 = matchConvertorV10.convert(match);
+        matchV10 = matchConvertorV10.convert(match, convertorManager);
         assertEquals(ZERO_MAC, matchV10.getDlDst());
         assertEquals(FF_MAC, matchV10.getDlSrc());
         assertEquals(0, matchV10.getDlType().intValue());
index e2d7de2439dd85f2bc04e9613a97fa2079c23950..eba0299e43cda8093386424b212995f376d6e2ee 100644 (file)
@@ -11,6 +11,8 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
@@ -23,8 +25,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  * match conversion and injection test
  */
 public class MatchReactorTest {
-
     private MatchBuilder matchBuilder;
+    private ConvertorManager convertorManager;
 
     /**
      * prepare input match
@@ -37,6 +39,7 @@ public class MatchReactorTest {
         ethernetTypeBuilder.setType(new EtherType(42L));
         ethernetMatchBuilder.setEthernetType(ethernetTypeBuilder.build());
         matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
     }
 
     /**
@@ -46,7 +49,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV13_flow() {
         FlowModInputBuilder target = new FlowModInputBuilder();
         MatchReactor.getInstance().convert(matchBuilder.build(),
-                OFConstants.OFP_VERSION_1_3, target);
+                OFConstants.OFP_VERSION_1_3, target, convertorManager);
         Assert.assertNotNull(target.getMatch());
     }
 
@@ -57,7 +60,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV10_flow() {
         FlowModInputBuilder target = new FlowModInputBuilder();
         MatchReactor.getInstance().convert(matchBuilder.build(),
-                OFConstants.OFP_VERSION_1_0, target);
+                OFConstants.OFP_VERSION_1_0, target, convertorManager);
         Assert.assertNotNull(target.getMatchV10());
     }
 
@@ -69,7 +72,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV13_mpRequestFlow() {
         MultipartRequestFlowBuilder target = new MultipartRequestFlowBuilder();
         MatchReactor.getInstance().convert(matchBuilder.build(),
-                OFConstants.OFP_VERSION_1_3, target);
+                OFConstants.OFP_VERSION_1_3, target, convertorManager);
         Assert.assertNotNull(target.getMatch());
     }
 
@@ -80,7 +83,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV10_mpRequestFlow() {
         MultipartRequestFlowBuilder target = new MultipartRequestFlowBuilder();
         MatchReactor.getInstance().convert(matchBuilder.build(),
-                OFConstants.OFP_VERSION_1_0, target);
+                OFConstants.OFP_VERSION_1_0, target, convertorManager);
         Assert.assertNotNull(target.getMatchV10());
     }
 
@@ -88,7 +91,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV10_null() {
         MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
         MatchReactor.getInstance().convert(null,
-                OFConstants.OFP_VERSION_1_0, target);
+                OFConstants.OFP_VERSION_1_0, target, convertorManager);
         Assert.assertNotNull(target.getMatchV10());
     }
 
@@ -99,7 +102,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV13_mpRequestAggregate() {
         MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
         MatchReactor.getInstance().convert(matchBuilder.build(),
-                OFConstants.OFP_VERSION_1_3, target);
+                OFConstants.OFP_VERSION_1_3, target, convertorManager);
         Assert.assertNotNull(target.getMatch());
     }
 
@@ -107,7 +110,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV13_null() {
         MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
         MatchReactor.getInstance().convert(null,
-                OFConstants.OFP_VERSION_1_3, target);
+                OFConstants.OFP_VERSION_1_3, target, convertorManager);
         Assert.assertNotNull(target.getMatch());
         Assert.assertEquals(0, target.getMatch().getMatchEntry().size());
     }
@@ -119,7 +122,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV10_mpRequestAggregate() {
         MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
         MatchReactor.getInstance().convert(matchBuilder.build(),
-                OFConstants.OFP_VERSION_1_0, target);
+                OFConstants.OFP_VERSION_1_0, target, convertorManager);
         Assert.assertNotNull(target.getMatchV10());
     }
 
index 361a69ad468034173a701ad2384e98554a00d369..e91667ca88f3679d2f11add55fbe9870b7eba922 100644 (file)
@@ -17,6 +17,7 @@ import org.junit.Before;
 import org.junit.Test;\r
 import org.opendaylight.openflowplugin.api.OFConstants;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;\r
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;\r
@@ -161,12 +162,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.matc
  */\r
 public class MatchResponseConvertor2Test {\r
 \r
+    private ConvertorManager convertorManager;\r
+\r
     /**\r
      * Initializes OpenflowPortsUtil\r
      */\r
     @Before\r
     public void startUp() {\r
         OpenflowPortsUtil.init();\r
+        convertorManager = ConvertorManagerFactory.createDefaultManager();\r
     }\r
 \r
     /**\r
@@ -174,7 +178,7 @@ public class MatchResponseConvertor2Test {
      */\r
     @Test(expected = NullPointerException.class)\r
     public void testEmptyMatch() {\r
-        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);\r
         datapathIdConvertorData.setDatapathId(new BigInteger("42"));\r
         convert(new MatchBuilder().build(), datapathIdConvertorData);\r
     }\r
@@ -191,7 +195,7 @@ public class MatchResponseConvertor2Test {
         builder.setMatchEntry(entries);\r
         final Match match = builder.build();\r
 \r
-        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);\r
         datapathIdConvertorData.setDatapathId(new BigInteger("42"));\r
 \r
         final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow\r
@@ -500,7 +504,7 @@ public class MatchResponseConvertor2Test {
 \r
         final Match match = builder.build();\r
 \r
-        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);\r
         datapathIdConvertorData.setDatapathId(new BigInteger("42"));\r
 \r
         final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow\r
@@ -650,7 +654,7 @@ public class MatchResponseConvertor2Test {
         builder.setMatchEntry(entries);\r
         final Match match = builder.build();\r
 \r
-        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);\r
+        final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);\r
         datapathIdConvertorData.setDatapathId(new BigInteger("42"));\r
 \r
         final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow\r
@@ -1604,7 +1608,7 @@ public class MatchResponseConvertor2Test {
     private org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow\r
             .MatchBuilder convert(Match match, VersionDatapathIdConvertorData data) {\r
         final Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow\r
-                .MatchBuilder> salMatchOptional = ConvertorManager.getInstance().convert(match, data);\r
+                .MatchBuilder> salMatchOptional = convertorManager.convert(match, data);\r
 \r
         return salMatchOptional\r
                 .orElse(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder());\r
index b806e1263c7e8f6cc26bfa9d6ec016b172dcb27f..c945cd4c8ad97b0d3dfcca06e27feb419301c4ef 100644 (file)
@@ -10,16 +10,16 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
 
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
-import org.junit.BeforeClass;
+import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
@@ -77,10 +77,12 @@ public class MatchResponseConvertorTest {
             Ipv4Address.getDefaultInstance("10.1.2.3");
 
     private static final int DL_VLAN_NONE = 0xffff;
+    private ConvertorManager convertorManager;
 
-    @BeforeClass
-    public static void setUp() {
+    @Before
+    public void setUp() {
         OpenflowPortsUtil.init();
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
     }
 
     /**
@@ -344,13 +346,13 @@ public class MatchResponseConvertorTest {
     }
 
     private MatchBuilder convert(MatchV10 match, VersionDatapathIdConvertorData data) {
-        final Optional<MatchBuilder> salMatchOptional = ConvertorManager.getInstance().convert(match, data);
+        final Optional<MatchBuilder> salMatchOptional = convertorManager.convert(match, data);
 
         return salMatchOptional.orElse(new MatchBuilder());
     }
 
     private MatchBuilder convert(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match match, VersionDatapathIdConvertorData data) {
-        final Optional<MatchBuilder> salMatchOptional = ConvertorManager.getInstance().convert(match, data);
+        final Optional<MatchBuilder> salMatchOptional = convertorManager.convert(match, data);
 
         return salMatchOptional.orElse(new MatchBuilder());
     }
index a8198d334c0f45e2cbe71a3679483d21746008f6..ffdc5032966a8daad1cb4b437f7db2df4da977f9 100644 (file)
@@ -15,6 +15,7 @@ import org.junit.Before;
 import org.junit.Test;\r
 import org.opendaylight.openflowplugin.api.OFConstants;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData;\r
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;\r
@@ -37,12 +38,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.matc
  */\r
 public class MatchV10ResponseConvertorTest {\r
 \r
+    private ConvertorManager convertorManager;\r
+\r
     /**\r
      * Initializes OpenflowPortsUtil\r
      */\r
     @Before\r
     public void startUp() {\r
         OpenflowPortsUtil.init();\r
+        convertorManager = ConvertorManagerFactory.createDefaultManager();\r
     }\r
 \r
     /**\r
@@ -815,7 +819,7 @@ public class MatchV10ResponseConvertorTest {
     }\r
 \r
     private MatchBuilder convert(MatchV10 match, VersionDatapathIdConvertorData data) {\r
-        final Optional<MatchBuilder> salMatchOptional = ConvertorManager.getInstance().convert(match, data);\r
+        final Optional<MatchBuilder> salMatchOptional = convertorManager.convert(match, data);\r
 \r
         return salMatchOptional.orElse(new MatchBuilder());\r
     }\r
index 4deaf1281279a7fb70bc5fbf42767eace2ab5590..9a94c3a6cef523ca3d116bf946cd3a46a44353fb 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.openflowplugin.openflow.md.core.session;
 
 import static org.mockito.Matchers.any;
+
 import com.google.common.util.concurrent.ListeningExecutorService;
 import java.math.BigInteger;
 import java.net.InetSocketAddress;
@@ -34,6 +35,8 @@ import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessio
 import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.SalRegistrationManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
@@ -91,7 +94,8 @@ public class SessionManagerOFImplTest {
         });
 
         // session listener - prepare registration and notification mockery
-        final SalRegistrationManager sessionListener = new SalRegistrationManager();
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        final SalRegistrationManager sessionListener = new SalRegistrationManager(convertorManager);
         sessionListener.setPublishService(notificationProviderService);
         sessionListener.setRpcProviderRegistry(rpcProviderRegistry);
         sessionListener.setDataService(dataService);
index a226c157960ff6155825359d198c3b8903139c25..629433734987280424e678f31e7d0c10ce8c1844 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.translator;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.when;
+
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
@@ -24,6 +25,8 @@ import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDist
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
 import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionConverterManagerImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionManagerOFImpl;
 import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
@@ -161,11 +164,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
-
 @RunWith(MockitoJUnitRunner.class)
-public class FlowRemovedTranslatorTest extends FlowRemovedTranslator {
+public class FlowRemovedTranslatorTest {
 
-    private static final FlowRemovedTranslator flowRemovedTranslator = new FlowRemovedTranslator();
+    private FlowRemovedTranslator flowRemovedTranslator;
     private static final BigInteger DATA_PATH_ID = BigInteger.valueOf(42);
     public static final Ipv6Address IPV_6_ADDRESS = new Ipv6Address("2001:0DB8:AC10:FE01:0000:0000:0000:0000");
     private static final byte[] IPV_6_ADDRESS_MASK = ByteUtil.unsignedIntToBytes(new Long(64));
@@ -538,6 +540,8 @@ public class FlowRemovedTranslatorTest extends FlowRemovedTranslator {
 
     @Before
     public void setup() {
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+        flowRemovedTranslator = new FlowRemovedTranslator(convertorManager);
         when(sessionContext.getPrimaryConductor()).thenReturn(connectionConductor);
         when(connectionConductor.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
         when(sessionContext.getFeatures()).thenReturn(featuresOutput);
index 56799b28cf2dfc2904a0df876b1e99ccf586bc09..bb046425dabde216ac22079e74ec8863d7b3c191 100644 (file)
@@ -13,15 +13,19 @@ import static org.mockito.Mockito.when;
 import java.math.BigInteger;\r
 import java.util.ArrayList;\r
 import java.util.List;\r
-\r
 import org.junit.Assert;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
 import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
+import org.mockito.runners.MockitoJUnitRunner;\r
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowplugin.api.OFConstants;\r
+import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeatureProperty;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeaturePropertyBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds;\r
@@ -50,21 +54,26 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
  * @author michal.polkorab\r
  *\r
  */\r
+@RunWith(MockitoJUnitRunner.class)\r
 public class MultipartReplyTableFeaturesToTableUpdatedTranslatorTest {\r
 \r
     @Mock SwitchConnectionDistinguisher cookie;\r
     @Mock SessionContext sc;\r
     @Mock GetFeaturesOutput features;\r
+    @Mock ConnectionConductor conductor;\r
 \r
-    MultipartReplyTableFeaturesToTableUpdatedTranslator translator = new MultipartReplyTableFeaturesToTableUpdatedTranslator();\r
+    MultipartReplyTableFeaturesToTableUpdatedTranslator translator;\r
 \r
     /**\r
      * Initializes mocks\r
      */\r
     @Before\r
     public void startUp() {\r
-        MockitoAnnotations.initMocks(this);\r
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+        translator = new MultipartReplyTableFeaturesToTableUpdatedTranslator(convertorManager);\r
+        when(sc.getPrimaryConductor()).thenReturn(conductor);\r
         when(sc.getFeatures()).thenReturn(features);\r
+        when(conductor.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);\r
         when(features.getDatapathId()).thenReturn(new BigInteger("42"));\r
     }\r
 \r
index d625aa38e1a902b54c5ce22159caa041c992d366..6413795b4f859f886c011031bbd977edabea7fb4 100644 (file)
@@ -16,12 +16,16 @@ import java.util.List;
 import org.junit.Assert;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
 import org.mockito.Mock;\r
 import org.mockito.MockitoAnnotations;\r
+import org.mockito.runners.MockitoJUnitRunner;\r
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterConfigStatsUpdated;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterStatisticsUpdated;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.config.stats.reply.MeterConfigStats;\r
@@ -56,6 +60,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 /**\r
  * @author michal.polkorab\r
  */\r
+@RunWith(MockitoJUnitRunner.class)\r
 public class MultipartReplyTranslatorFifthTest {\r
 \r
     @Mock\r
@@ -67,13 +72,15 @@ public class MultipartReplyTranslatorFifthTest {
     @Mock\r
     GetFeaturesOutput features;\r
 \r
-    MultipartReplyTranslator translator = new MultipartReplyTranslator();\r
+    MultipartReplyTranslator translator;\r
 \r
     /**\r
      * Initializes mocks\r
      */\r
     @Before\r
     public void startUp() {\r
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+        translator = new MultipartReplyTranslator(convertorManager);\r
         MockitoAnnotations.initMocks(this);\r
         when(sc.getPrimaryConductor()).thenReturn(conductor);\r
         when(conductor.getVersion()).thenReturn((short) EncodeConstants.OF13_VERSION_ID);\r
index 5abafe5ce3d34c61e4eacb3b9fdf8a01c8649593..f4051a80c80571355850600aec7ecd305c62edf6 100644 (file)
@@ -13,16 +13,18 @@ import static org.mockito.Mockito.when;
 import java.math.BigInteger;\r
 import java.util.ArrayList;\r
 import java.util.List;\r
-\r
 import org.junit.Assert;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
 import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
+import org.mockito.runners.MockitoJUnitRunner;\r
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;\r
+import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;\r
@@ -48,6 +50,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
  * @author michal.polkorab\r
  *\r
  */\r
+@RunWith(MockitoJUnitRunner.class)\r
 public class MultipartReplyTranslatorFirstTest {\r
 \r
     @Mock SwitchConnectionDistinguisher cookie;\r
@@ -55,14 +58,15 @@ public class MultipartReplyTranslatorFirstTest {
     @Mock ConnectionConductor conductor;\r
     @Mock GetFeaturesOutput features;\r
 \r
-    MultipartReplyTranslator translator = new MultipartReplyTranslator();\r
+    MultipartReplyTranslator translator;\r
 \r
     /**\r
      * Initializes mocks\r
      */\r
     @Before\r
     public void startUp() {\r
-        MockitoAnnotations.initMocks(this);\r
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+        translator = new MultipartReplyTranslator(convertorManager);\r
         when(sc.getPrimaryConductor()).thenReturn(conductor);\r
         when(conductor.getVersion()).thenReturn((short) EncodeConstants.OF13_VERSION_ID);\r
         when(sc.getFeatures()).thenReturn(features);\r
index af8fa893c8f3117e714af6b4e4c20a65557bf89c..412b67cbcb8d17347b740b4228a557be1b584fd2 100644 (file)
@@ -9,18 +9,22 @@
 package org.opendaylight.openflowplugin.openflow.md.core.translator;\r
 \r
 import static org.mockito.Mockito.when;\r
+\r
 import java.math.BigInteger;\r
 import java.util.ArrayList;\r
 import java.util.List;\r
 import org.junit.Assert;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
 import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
+import org.mockito.runners.MockitoJUnitRunner;\r
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupDescStatsUpdated;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;\r
@@ -57,6 +61,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
  * @author michal.polkorab\r
  *\r
  */\r
+@RunWith(MockitoJUnitRunner.class)\r
 public class MultipartReplyTranslatorFourthTest {\r
 \r
     @Mock SwitchConnectionDistinguisher cookie;\r
@@ -64,14 +69,15 @@ public class MultipartReplyTranslatorFourthTest {
     @Mock ConnectionConductor conductor;\r
     @Mock GetFeaturesOutput features;\r
 \r
-    MultipartReplyTranslator translator = new MultipartReplyTranslator();\r
+    MultipartReplyTranslator translator;\r
 \r
     /**\r
      * Initializes mocks\r
      */\r
     @Before\r
     public void startUp() {\r
-        MockitoAnnotations.initMocks(this);\r
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+        translator = new MultipartReplyTranslator(convertorManager);\r
         when(sc.getPrimaryConductor()).thenReturn(conductor);\r
         when(conductor.getVersion()).thenReturn((short) EncodeConstants.OF13_VERSION_ID);\r
         when(sc.getFeatures()).thenReturn(features);\r
index b1ea6ff4526c882b1c748cddc79fb26f4a02f74d..737d2ebbeaf43af32fecef9c092e63a5e0f682a3 100644 (file)
@@ -13,16 +13,18 @@ import static org.mockito.Mockito.when;
 import java.math.BigInteger;\r
 import java.util.ArrayList;\r
 import java.util.List;\r
-\r
 import org.junit.Assert;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
 import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
+import org.mockito.runners.MockitoJUnitRunner;\r
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;\r
+import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsUpdate;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupFeaturesUpdated;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterFeaturesUpdated;\r
@@ -49,6 +51,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
  * @author michal.polkorab\r
  *\r
  */\r
+@RunWith(MockitoJUnitRunner.class)\r
 public class MultipartReplyTranslatorSecondTest {\r
 \r
     @Mock SwitchConnectionDistinguisher cookie;\r
@@ -56,14 +59,15 @@ public class MultipartReplyTranslatorSecondTest {
     @Mock ConnectionConductor conductor;\r
     @Mock GetFeaturesOutput features;\r
 \r
-    MultipartReplyTranslator translator = new MultipartReplyTranslator();\r
+    MultipartReplyTranslator translator;\r
 \r
     /**\r
      * Initializes mocks\r
      */\r
     @Before\r
     public void startUp() {\r
-        MockitoAnnotations.initMocks(this);\r
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+        translator = new MultipartReplyTranslator(convertorManager);\r
         when(sc.getPrimaryConductor()).thenReturn(conductor);\r
         when(conductor.getVersion()).thenReturn((short) EncodeConstants.OF13_VERSION_ID);\r
         when(sc.getFeatures()).thenReturn(features);\r
index 24aa3849d075027047903ae899b2f656a7ba2d36..eec1af26c7379f50bfe76db201c147e2e223fbdd 100644 (file)
@@ -13,17 +13,19 @@ import static org.mockito.Mockito.when;
 import java.math.BigInteger;\r
 import java.util.ArrayList;\r
 import java.util.List;\r
-\r
 import org.junit.Assert;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
 import org.mockito.Mock;\r
-import org.mockito.MockitoAnnotations;\r
+import org.mockito.runners.MockitoJUnitRunner;\r
 import org.opendaylight.openflowjava.protocol.api.util.BinContent;\r
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;\r
+import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;\r
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;\r
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;\r
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMap;\r
@@ -56,6 +58,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
  * @author michal.polkorab\r
  *\r
  */\r
+@RunWith(MockitoJUnitRunner.class)\r
 public class MultipartReplyTranslatorThirdTest {\r
 \r
     @Mock SwitchConnectionDistinguisher cookie;\r
@@ -63,14 +66,15 @@ public class MultipartReplyTranslatorThirdTest {
     @Mock ConnectionConductor conductor;\r
     @Mock GetFeaturesOutput features;\r
 \r
-    MultipartReplyTranslator translator = new MultipartReplyTranslator();\r
+    MultipartReplyTranslator translator;\r
 \r
     /**\r
      * Initializes mocks\r
      */\r
     @Before\r
     public void startUp() {\r
-        MockitoAnnotations.initMocks(this);\r
+        final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();\r
+        translator = new MultipartReplyTranslator(convertorManager);\r
         when(sc.getPrimaryConductor()).thenReturn(conductor);\r
         when(conductor.getVersion()).thenReturn((short) EncodeConstants.OF13_VERSION_ID);\r
         when(sc.getFeatures()).thenReturn(features);\r