use of org.opendaylight.genius.itm.api.IITMProvider in project netvirt by opendaylight.
the class ElanServiceTestModule method configureBindings.
@Override
protected void configureBindings() {
DataBroker dataBroker = DataBrokerTestModule.dataBroker();
EntityOwnershipService mockedEntityOwnershipService = mock(EntityOwnershipService.class);
EntityOwnershipState mockedEntityOwnershipState = EntityOwnershipState.IS_OWNER;
Mockito.when(mockedEntityOwnershipService.getOwnershipState(Mockito.any())).thenReturn(Optional.of(mockedEntityOwnershipState));
bind(EntityOwnershipService.class).toInstance(mockedEntityOwnershipService);
bind(L2GatewayCache.class).to(L2GatewayCacheImpl.class);
bind(HwvtepHACache.class).toInstance(mock(HwvtepHACache.class));
bind(ServiceRecoveryRegistry.class).toInstance(mock(ServiceRecoveryRegistry.class));
bind(INeutronVpnManager.class).toInstance(mock(NeutronvpnManagerImpl.class));
IVpnManager ivpnManager = mock(VpnManagerTestImpl.class, CALLS_REAL_METHODS);
MDSALManager mockedMdsalManager = new MDSALManager(dataBroker, mock(PacketProcessingService.class));
bind(IMdsalApiManager.class).toInstance(mockedMdsalManager);
// Bindings for external services to "real" implementations
bind(LockManagerService.class).to(LockManagerServiceImpl.class);
bind(ElanConfig.class).toInstance(new ElanConfigBuilder().setIntBridgeGenMac(true).setTempSmacLearnTimeout(Uint16.TEN).build());
bind(MetricProvider.class).toInstance(new TestMetricProviderImpl());
// Bindings of all listeners (which are not directly referenced in the code)
// This is required to be explicit here, because these are referenced neither from src/main nor src/test
// and we, intentionally, don't use "classpath scanning for auto-discovery"
// so this list must kept, manually, in line with the rc/main/resources/org/opendaylight/blueprint/*.xml
// and target/generated-resources/org/opendaylight/blueprint/autowire.xml
// bind(ElanGroupListener.class);
// TODO complete this list!!! after Gerrit which adds @Inject to all listeners
// Bindings to test infra (fakes & mocks)
TestInterfaceManager testInterfaceManager = TestInterfaceManager.newInstance(dataBroker);
IITMProvider testItmProvider = TestItmProvider.newInstance();
ItmRpcService itmRpcService = new ItmRpcTestImpl();
bind(DataBroker.class).toInstance(dataBroker);
bind(IdManagerService.class).toInstance(mock(IdHelper.class, CALLS_REAL_METHODS));
bind(IInterfaceManager.class).toInstance(testInterfaceManager);
bind(TestInterfaceManager.class).toInstance(testInterfaceManager);
bind(IITMProvider.class).toInstance(testItmProvider);
InterfaceMetaUtils interfaceMetaUtils = new InterfaceMetaUtils(dataBroker, mock(IdHelper.class, CALLS_REAL_METHODS), mock(BatchingUtils.class));
InterfaceManagerCommonUtils interfaceManagerCommonUtils = new InterfaceManagerCommonUtils(dataBroker, mockedMdsalManager, mock(IdHelper.class, CALLS_REAL_METHODS), interfaceMetaUtils, mock(BatchingUtils.class));
bind(OdlInterfaceRpcService.class).toInstance(ElanEgressActionsHelper.newInstance(interfaceManagerCommonUtils, testInterfaceManager));
SingleTransactionDataBroker singleTransactionDataBroker = new SingleTransactionDataBroker(dataBroker);
bind(SingleTransactionDataBroker.class).toInstance(singleTransactionDataBroker);
IBgpManager ibgpManager = BgpManagerTestImpl.newInstance(singleTransactionDataBroker);
bind(ItmRpcService.class).toInstance(itmRpcService);
bind(ItmRpcTestImpl.class).toInstance((ItmRpcTestImpl) itmRpcService);
bind(DataImportBootReady.class).toInstance(new DataImportBootReady() {
});
bind(DiagStatusService.class).toInstance(mock(DiagStatusService.class));
bind(IVpnManager.class).toInstance(ivpnManager);
bind(IBgpManager.class).toInstance(ibgpManager);
bind(IElanService.class).to(ElanServiceProvider.class);
MdsalUtils mdsalUtils = new MdsalUtils(dataBroker);
bind(MdsalUtils.class).toInstance(mdsalUtils);
bind(SouthboundUtils.class).toInstance(new SouthboundUtils(mdsalUtils));
bind(IL2gwService.class).toInstance(mock(IL2gwService.class));
}
Aggregations