use of org.opendaylight.controller.md.sal.binding.api.DataBroker in project lispflowmapping by opendaylight.
the class MappingDataListenerTest method init.
@Before
@SuppressWarnings("unchecked")
public void init() {
final DataBroker dataBrokerMock = Mockito.mock(DataBroker.class);
iMappingSystemMock = Mockito.mock(IMappingSystem.class);
notificationPublishServiceMock = Mockito.mock(NotificationPublishService.class);
mappingDataListener = new MappingDataListener(dataBrokerMock, iMappingSystemMock, notificationPublishServiceMock);
final InstanceIdentifier<Mapping> instanceIdentifierMock = Mockito.mock(InstanceIdentifier.class);
final DataTreeIdentifier<Mapping> dataTreeIdentifier = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, instanceIdentifierMock);
change_del = Mockito.mock(DataTreeModification.class);
change_subtreeModified = Mockito.mock(DataTreeModification.class);
change_write = Mockito.mock(DataTreeModification.class);
mod_del = Mockito.mock(DataObjectModification.class);
mod_subtreeModified = Mockito.mock(DataObjectModification.class);
mod_write = Mockito.mock(DataObjectModification.class);
Mockito.when(change_del.getRootPath()).thenReturn(dataTreeIdentifier);
Mockito.when(change_del.getRootNode()).thenReturn(mod_del);
Mockito.when(change_subtreeModified.getRootPath()).thenReturn(dataTreeIdentifier);
Mockito.when(change_subtreeModified.getRootNode()).thenReturn(mod_subtreeModified);
Mockito.when(change_write.getRootPath()).thenReturn(dataTreeIdentifier);
Mockito.when(change_write.getRootNode()).thenReturn(mod_write);
Mockito.when(mod_del.getModificationType()).thenReturn(ModificationType.DELETE);
Mockito.when(mod_subtreeModified.getModificationType()).thenReturn(ModificationType.SUBTREE_MODIFIED);
Mockito.when(mod_write.getModificationType()).thenReturn(ModificationType.WRITE);
Mockito.when(iMappingSystemMock.isMaster()).thenReturn(true);
}
use of org.opendaylight.controller.md.sal.binding.api.DataBroker in project genius by opendaylight.
the class ItmManagerRpcService method isDcgwPresent.
@Override
public Future<RpcResult<IsDcgwPresentOutput>> isDcgwPresent(IsDcgwPresentInput input) {
RpcResultBuilder<IsDcgwPresentOutput> resultBld = RpcResultBuilder.success();
List<DcGatewayIp> dcGatewayIpList = ItmUtils.getDcGatewayIpList(dataBroker);
String dcgwIpStr = input.getDcgwIp();
IpAddress dcgwIpAddr = IpAddressBuilder.getDefaultInstance(dcgwIpStr);
long retVal;
if (dcGatewayIpList != null && !dcGatewayIpList.isEmpty() && dcGatewayIpList.stream().anyMatch(gwIp -> Objects.equal(gwIp.getIpAddress(), dcgwIpAddr))) {
// Match found
retVal = 1;
IsDcgwPresentOutputBuilder output = new IsDcgwPresentOutputBuilder().setRetVal(retVal);
resultBld.withResult(output.build());
} else {
// Match not found
retVal = 2;
IsDcgwPresentOutputBuilder output = new IsDcgwPresentOutputBuilder().setRetVal(retVal);
resultBld.withResult(output.build());
}
return Futures.immediateFuture(resultBld.build());
}
use of org.opendaylight.controller.md.sal.binding.api.DataBroker in project genius by opendaylight.
the class ItmTestModule method configureBindings.
@Override
protected void configureBindings() {
// Bindings for services from this project
bind(ItmRpcService.class).to(ItmManagerRpcService.class);
bind(ItmProvider.class);
ItmConfig itmConfigObj = new ItmConfigBuilder().setDefTzEnabled(true).setDefTzTunnelType(ITMConstants.TUNNEL_TYPE_VXLAN).setGpeExtensionEnabled(false).build();
bind(ItmConfig.class).toInstance(itmConfigObj);
IfmConfig interfaceConfig = new IfmConfigBuilder().setItmDirectTunnels(false).build();
bind(IfmConfig.class).toInstance(interfaceConfig);
bind(TunnelMonitorIntervalListener.class);
bind(TransportZoneListener.class);
bind(OvsdbNodeListener.class);
bind(InterfaceStateListener.class);
bind(VtepConfigSchemaListener.class);
bind(TunnelMonitorChangeListener.class);
bind(ItmTunnelEventListener.class);
// Bindings for external services to "real" implementations
bind(EntityOwnershipService.class).toInstance(mock(EntityOwnershipService.class));
bind(IdManagerService.class).to(IdManager.class);
bind(LockManagerService.class).to(LockManagerServiceImpl.class);
DataBroker dataBroker = DataBrokerTestModule.dataBroker();
bind(DataBroker.class).toInstance(dataBroker);
bind(DataBroker.class).annotatedWith(OsgiService.class).toInstance(dataBroker);
bind(InterfaceManagerService.class).to(InterfaceManagerServiceImpl.class);
bind(IInterfaceManager.class).to(InterfacemgrProvider.class);
bind(ServiceRecoveryRegistry.class).toInstance(mock(ServiceRecoveryRegistry.class));
// Bindings to test infra (fakes & mocks)
TestIMdsalApiManager mdsalManager = TestIMdsalApiManager.newInstance();
bind(IMdsalApiManager.class).toInstance(mdsalManager);
bind(TestIMdsalApiManager.class).toInstance(mdsalManager);
bind(DataImportBootReady.class).annotatedWith(OsgiService.class).toInstance(new DataImportBootReady() {
});
bind(DiagStatusService.class).toInstance(mock(DiagStatusService.class));
}
use of org.opendaylight.controller.md.sal.binding.api.DataBroker in project genius by opendaylight.
the class InterfaceManagerTestModule method configureBindings.
@Override
protected void configureBindings() throws UnknownHostException {
// Bindings for services from this project
// Bindings for external services to "real" implementations
// Bindings to test infra (fakes & mocks)
DataBrokerTestModule dataBrokerTestModule = new DataBrokerTestModule(false);
DataBroker dataBroker = dataBrokerTestModule.getDataBroker();
bind(DataBroker.class).toInstance(dataBroker);
bind(DataBroker.class).annotatedWith(OsgiService.class).toInstance(dataBroker);
bind(DataImportBootReady.class).annotatedWith(OsgiService.class).toInstance(new DataImportBootReady() {
});
bind(LockManagerService.class).to(LockManagerServiceImpl.class);
bind(LockListener.class);
bind(IdManagerService.class).to(IdManager.class);
bind(IInterfaceManager.class).to(InterfacemgrProvider.class);
TestIMdsalApiManager mdsalManager = TestIMdsalApiManager.newInstance();
bind(IMdsalApiManager.class).toInstance(mdsalManager);
bind(TestIMdsalApiManager.class).toInstance(mdsalManager);
bind(AbstractTestableListener.class).to(TestableDataTreeChangeListener.class);
bind(JobCoordinatorCountedEventsWaiter.class).to(TestableJobCoordinatorCountedEventsWaiter.class);
bind(InterfaceManagerService.class).to(InterfaceManagerServiceImpl.class);
bind(ServiceRecoveryRegistry.class).toInstance(mock(ServiceRecoveryRegistry.class));
EntityOwnershipService entityOwnershipService = new BindingDOMEntityOwnershipServiceAdapter(new SimpleDOMEntityOwnershipService(), dataBrokerTestModule.getBindingToNormalizedNodeCodec());
bind(EntityOwnershipService.class).toInstance(entityOwnershipService);
bind(EntityOwnershipUtils.class);
bind(AlivenessMonitorService.class).toInstance(mock(AlivenessMonitorService.class));
bind(OdlInterfaceRpcService.class).to(InterfaceManagerRpcService.class);
bind(CacheBridgeEntryConfigListener.class);
bind(CacheBridgeRefEntryListener.class);
bind(FlowBasedServicesConfigListener.class);
bind(FlowBasedServicesInterfaceStateListener.class);
bind(HwVTEPConfigListener.class);
bind(HwVTEPTunnelsStateListener.class);
bind(InterfaceConfigListener.class);
bind(InterfaceInventoryStateListener.class);
bind(InterfaceTopologyStateListener.class);
bind(TerminationPointStateListener.class);
bind(VlanMemberConfigListener.class);
bind(InterfaceStateListener.class);
bind(HwvtepNodeHACache.class).toInstance(mock(HwvtepNodeHACache.class));
bind(IfmConfig.class).toInstance(mock(IfmConfig.class));
}
use of org.opendaylight.controller.md.sal.binding.api.DataBroker in project genius by opendaylight.
the class ArpUtilTestModule method configureBindings.
@Override
protected void configureBindings() throws UnknownHostException {
DataBroker dataBroker = DataBrokerTestModule.dataBroker();
bind(DataBroker.class).toInstance(dataBroker);
TestOdlInterfaceRpcService testOdlInterfaceRpcService = TestOdlInterfaceRpcService.newInstance();
bind(OdlInterfaceRpcService.class).toInstance(testOdlInterfaceRpcService);
TestPacketProcessingService testPacketProcessingService = TestPacketProcessingService.newInstance();
bind(PacketProcessingService.class).toInstance(testPacketProcessingService);
bind(NotificationService.class).toInstance(mock(NotificationService.class));
bind(NotificationPublishService.class).toInstance(mock(NotificationPublishService.class));
bind(OdlArputilService.class).to(ArpUtilImpl.class);
bind(MetricProvider.class).toInstance(mock(MetricProvider.class, RETURNS_DEEP_STUBS));
}
Aggregations