Search in sources :

Example 26 with DataBroker

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);
}
Also used : DataTreeModification(org.opendaylight.controller.md.sal.binding.api.DataTreeModification) DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) DataObjectModification(org.opendaylight.controller.md.sal.binding.api.DataObjectModification) IMappingSystem(org.opendaylight.lispflowmapping.interfaces.mapcache.IMappingSystem) Mapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) NotificationPublishService(org.opendaylight.controller.md.sal.binding.api.NotificationPublishService) Before(org.junit.Before)

Example 27 with DataBroker

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());
}
Also used : SetBfdEnableOnTunnelInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.SetBfdEnableOnTunnelInput) DpnEndpoints(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.DpnEndpoints) IsTunnelInternalOrExternalOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.IsTunnelInternalOrExternalOutput) DcGatewayIpKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIpKey) BridgeRefEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry) GetInternalOrExternalInterfaceNameOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetInternalOrExternalInterfaceNameOutput) Future(java.util.concurrent.Future) TransportZones(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones) GetExternalTunnelInterfaceNameOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameOutputBuilder) Optional(com.google.common.base.Optional) DcGatewayIp(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp) Map(java.util.Map) ItmExternalTunnelAddWorker(org.opendaylight.genius.itm.confighelpers.ItmExternalTunnelAddWorker) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo) GetExternalTunnelInterfaceNameOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameOutput) BigInteger(java.math.BigInteger) ItmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig) DeviceVtepsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsBuilder) DeleteL2GwMlagDeviceInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.DeleteL2GwMlagDeviceInput) IsDcgwPresentOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.IsDcgwPresentOutputBuilder) AddExternalTunnelEndpointInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.AddExternalTunnelEndpointInput) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) ExternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelKey) ComputesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.get.dpn.info.output.ComputesBuilder) SubnetsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsKey) GetTunnelTypeInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelTypeInput) DeleteL2GwDeviceInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.DeleteL2GwDeviceInput) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) ArrayList(java.util.ArrayList) CreateTerminatingServiceActionsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.CreateTerminatingServiceActionsInput) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) BridgeRefEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntryKey) ExternalTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.ExternalTunnelList) GetTunnelInterfaceNameOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutputBuilder) AddL2GwMlagDeviceInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.AddL2GwMlagDeviceInput) RemoveExternalTunnelFromDpnsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.RemoveExternalTunnelFromDpnsInput) FutureCallback(com.google.common.util.concurrent.FutureCallback) Futures(com.google.common.util.concurrent.Futures) DPNTEPsInfoKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) GetDpnInfoOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnInfoOutput) GetDpnInfoOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnInfoOutputBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Subnets(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Subnets) ItmUtils(org.opendaylight.genius.itm.impl.ItmUtils) RpcError(org.opendaylight.yangtools.yang.common.RpcError) IsDcgwPresentInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.IsDcgwPresentInput) SingleTransactionDataBroker(org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker) InternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnel) GetDpnEndpointIpsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnEndpointIpsOutput) Vteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps) GetEgressActionsForTunnelOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelOutput) LoggerFactory(org.slf4j.LoggerFactory) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) GetExternalTunnelInterfaceNameInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameInput) GetInternalOrExternalInterfaceNameOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetInternalOrExternalInterfaceNameOutputBuilder) SettableFuture(com.google.common.util.concurrent.SettableFuture) BridgeRefInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.BridgeRefInfo) GetDpnEndpointIpsOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnEndpointIpsOutputBuilder) GetInternalOrExternalInterfaceNameInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetInternalOrExternalInterfaceNameInput) DcGatewayIpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIpBuilder) RemoveTerminatingServiceActionsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.RemoveTerminatingServiceActionsInput) PreDestroy(javax.annotation.PreDestroy) ExternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone) GetEgressActionsForTunnelInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelInput) DcGatewayIpList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.DcGatewayIpList) DeviceVteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVteps) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) IsDcgwPresentOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.IsDcgwPresentOutput) RemoveExternalTunnelEndpointInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.RemoveExternalTunnelEndpointInput) Objects(com.google.common.base.Objects) TunnelTypeLogicalGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup) IsTunnelInternalOrExternalInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.IsTunnelInternalOrExternalInput) GetTunnelInterfaceNameOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput) ItmExternalTunnelDeleteWorker(org.opendaylight.genius.itm.confighelpers.ItmExternalTunnelDeleteWorker) Collection(java.util.Collection) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) GetTunnelInterfaceNameInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInput) TunnelEndPoints(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints) IsTunnelInternalOrExternalOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.IsTunnelInternalOrExternalOutputBuilder) Collectors(java.util.stream.Collectors) WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) List(java.util.List) DeviceVtepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsKey) PostConstruct(javax.annotation.PostConstruct) Computes(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.get.dpn.info.output.Computes) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) FutureRpcResults(org.opendaylight.genius.infra.FutureRpcResults) AddL2GwDeviceInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.AddL2GwDeviceInput) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) HashMap(java.util.HashMap) Singleton(javax.inject.Singleton) Inject(javax.inject.Inject) GetDpnEndpointIpsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnEndpointIpsInput) MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) DPNTEPsInfoCache(org.opendaylight.genius.itm.cache.DPNTEPsInfoCache) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) BuildExternalTunnelFromDpnsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.BuildExternalTunnelFromDpnsInput) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) Logger(org.slf4j.Logger) GetTunnelTypeOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelTypeOutput) TransportZoneKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey) RpcResultBuilder(org.opendaylight.yangtools.yang.common.RpcResultBuilder) ITMConstants(org.opendaylight.genius.itm.globals.ITMConstants) GetDpnInfoInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnInfoInput) Collections(java.util.Collections) IpAddressBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder) ItmRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService) IsDcgwPresentOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.IsDcgwPresentOutputBuilder) IsDcgwPresentOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.IsDcgwPresentOutput) DcGatewayIp(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)

Example 28 with DataBroker

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));
}
Also used : InterfaceManagerService(org.opendaylight.genius.interfacemanager.interfaces.InterfaceManagerService) IInterfaceManager(org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager) ItmConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder) TestIMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) LockManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService) TestIMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) ItmRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService) ItmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig) IfmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.config.rev160406.IfmConfig) EntityOwnershipService(org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) IfmConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.config.rev160406.IfmConfigBuilder) ServiceRecoveryRegistry(org.opendaylight.genius.srm.ServiceRecoveryRegistry) DataImportBootReady(org.opendaylight.daexim.DataImportBootReady) DiagStatusService(org.opendaylight.infrautils.diagstatus.DiagStatusService) OsgiService(org.ops4j.pax.cdi.api.OsgiService)

Example 29 with DataBroker

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));
}
Also used : InterfaceManagerService(org.opendaylight.genius.interfacemanager.interfaces.InterfaceManagerService) IInterfaceManager(org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager) TestIMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) AbstractTestableListener(org.opendaylight.genius.datastoreutils.testutils.AbstractTestableListener) AlivenessMonitorService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.AlivenessMonitorService) LockManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService) TestIMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) HwvtepNodeHACache(org.opendaylight.genius.utils.hwvtep.HwvtepNodeHACache) OdlInterfaceRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService) DataBrokerTestModule(org.opendaylight.controller.md.sal.binding.test.DataBrokerTestModule) IfmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.config.rev160406.IfmConfig) JobCoordinatorCountedEventsWaiter(org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorCountedEventsWaiter) TestableJobCoordinatorCountedEventsWaiter(org.opendaylight.genius.datastoreutils.testutils.TestableJobCoordinatorCountedEventsWaiter) EntityOwnershipService(org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService) SimpleDOMEntityOwnershipService(org.opendaylight.mdsal.eos.dom.simple.SimpleDOMEntityOwnershipService) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) SimpleDOMEntityOwnershipService(org.opendaylight.mdsal.eos.dom.simple.SimpleDOMEntityOwnershipService) ServiceRecoveryRegistry(org.opendaylight.genius.srm.ServiceRecoveryRegistry) BindingDOMEntityOwnershipServiceAdapter(org.opendaylight.mdsal.eos.binding.dom.adapter.BindingDOMEntityOwnershipServiceAdapter) DataImportBootReady(org.opendaylight.daexim.DataImportBootReady) OsgiService(org.ops4j.pax.cdi.api.OsgiService)

Example 30 with DataBroker

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));
}
Also used : OdlInterfaceRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService) MetricProvider(org.opendaylight.infrautils.metrics.MetricProvider) OdlArputilService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.arputil.rev160406.OdlArputilService) NotificationService(org.opendaylight.controller.md.sal.binding.api.NotificationService) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) PacketProcessingService(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService) NotificationPublishService(org.opendaylight.controller.md.sal.binding.api.NotificationPublishService)

Aggregations

DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)67 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)38 Optional (com.google.common.base.Optional)37 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)37 Logger (org.slf4j.Logger)37 LoggerFactory (org.slf4j.LoggerFactory)36 ArrayList (java.util.ArrayList)34 List (java.util.List)33 BigInteger (java.math.BigInteger)31 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)30 Collections (java.util.Collections)29 Inject (javax.inject.Inject)29 Singleton (javax.inject.Singleton)29 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)25 NwConstants (org.opendaylight.genius.mdsalutil.NwConstants)24 MDSALUtil (org.opendaylight.genius.mdsalutil.MDSALUtil)23 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)22 IMdsalApiManager (org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager)22 FutureCallback (com.google.common.util.concurrent.FutureCallback)21 PostConstruct (javax.annotation.PostConstruct)21