Search in sources :

Example 1 with DcGatewayIp

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp in project genius by opendaylight.

the class ItmManagerRpcService method addExternalTunnelEndpoint.

@Override
public Future<RpcResult<Void>> addExternalTunnelEndpoint(AddExternalTunnelEndpointInput input) {
    // TODO Auto-generated method stub
    // Ignore the Futures for now
    final SettableFuture<RpcResult<Void>> result = SettableFuture.create();
    Collection<DPNTEPsInfo> meshedDpnList = dpnTEPsInfoCache.getAllPresent();
    externalTunnelAddWorker.buildTunnelsToExternalEndPoint(meshedDpnList, input.getDestinationIp(), input.getTunnelType());
    InstanceIdentifier<DcGatewayIp> extPath = InstanceIdentifier.builder(DcGatewayIpList.class).child(DcGatewayIp.class, new DcGatewayIpKey(input.getDestinationIp())).build();
    DcGatewayIp dcGatewayIp = new DcGatewayIpBuilder().setIpAddress(input.getDestinationIp()).setTunnnelType(input.getTunnelType()).build();
    WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
    writeTransaction.put(LogicalDatastoreType.CONFIGURATION, extPath, dcGatewayIp, true);
    ListenableFuture<Void> futureCheck = writeTransaction.submit();
    Futures.addCallback(futureCheck, new FutureCallback<Void>() {

        @Override
        public void onSuccess(Void voidInstance) {
            result.set(RpcResultBuilder.<Void>success().build());
        }

        @Override
        public void onFailure(Throwable error) {
            String msg = "Unable to create DcGatewayIp {} in datastore for ip " + input.getDestinationIp() + "and " + "tunnel type " + input.getTunnelType();
            LOG.error("Unable to create DcGatewayIp in datastore for ip {} and tunnel type {}", input.getDestinationIp(), input.getTunnelType());
            result.set(RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.APPLICATION, msg, error).build());
        }
    });
    return result;
}
Also used : DcGatewayIpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIpBuilder) WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) DcGatewayIp(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp) DcGatewayIpKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIpKey) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)

Example 2 with DcGatewayIp

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp 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 3 with DcGatewayIp

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp in project netvirt by opendaylight.

the class VpnInstanceListener method getDcGatewayTunnelInterfaceNameList.

private List<String> getDcGatewayTunnelInterfaceNameList() {
    List<String> tunnelInterfaceNameList = new ArrayList<>();
    InstanceIdentifier<DcGatewayIpList> dcGatewayIpListInstanceIdentifier = InstanceIdentifier.create(DcGatewayIpList.class);
    Optional<DcGatewayIpList> dcGatewayIpListOptional = VpnUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, dcGatewayIpListInstanceIdentifier);
    if (!dcGatewayIpListOptional.isPresent()) {
        LOG.info("No DC gateways configured.");
        return tunnelInterfaceNameList;
    }
    List<DcGatewayIp> dcGatewayIps = dcGatewayIpListOptional.get().getDcGatewayIp();
    InstanceIdentifier<ExternalTunnelList> externalTunnelListId = InstanceIdentifier.create(ExternalTunnelList.class);
    Optional<ExternalTunnelList> externalTunnelListOptional = VpnUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, externalTunnelListId);
    if (externalTunnelListOptional.isPresent()) {
        List<ExternalTunnel> externalTunnels = externalTunnelListOptional.get().getExternalTunnel();
        List<String> externalTunnelIpList = new ArrayList<>();
        for (ExternalTunnel externalTunnel : externalTunnels) {
            externalTunnelIpList.add(externalTunnel.getDestinationDevice());
        }
        List<String> dcGatewayIpList = new ArrayList<>();
        for (DcGatewayIp dcGatewayIp : dcGatewayIps) {
            dcGatewayIpList.add(dcGatewayIp.getIpAddress().getIpv4Address().toString());
        }
        // Find all externalTunnelIps present in dcGateWayIpList
        List<String> externalTunnelIpsInDcGatewayIpList = new ArrayList<>();
        for (String externalTunnelIp : externalTunnelIpList) {
            for (String dcGateWayIp : dcGatewayIpList) {
                if (externalTunnelIp.contentEquals(dcGateWayIp)) {
                    externalTunnelIpsInDcGatewayIpList.add(externalTunnelIp);
                }
            }
        }
        for (String externalTunnelIpsInDcGatewayIp : externalTunnelIpsInDcGatewayIpList) {
            for (ExternalTunnel externalTunnel : externalTunnels) {
                if (externalTunnel.getDestinationDevice().contentEquals(externalTunnelIpsInDcGatewayIp)) {
                    tunnelInterfaceNameList.add(externalTunnel.getTunnelInterfaceName());
                }
            }
        }
    }
    return tunnelInterfaceNameList;
}
Also used : ExternalTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.ExternalTunnelList) ExternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel) ArrayList(java.util.ArrayList) DcGatewayIpList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.DcGatewayIpList) DcGatewayIp(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp)

Example 4 with DcGatewayIp

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp in project genius by opendaylight.

the class ItmManagerRpcService method removeExternalTunnelEndpoint.

@Override
public Future<RpcResult<Void>> removeExternalTunnelEndpoint(RemoveExternalTunnelEndpointInput input) {
    // Ignore the Futures for now
    final SettableFuture<RpcResult<Void>> result = SettableFuture.create();
    Collection<DPNTEPsInfo> meshedDpnList = dpnTEPsInfoCache.getAllPresent();
    ItmExternalTunnelDeleteWorker.deleteTunnels(dataBroker, meshedDpnList, input.getDestinationIp(), input.getTunnelType());
    InstanceIdentifier<DcGatewayIp> extPath = InstanceIdentifier.builder(DcGatewayIpList.class).child(DcGatewayIp.class, new DcGatewayIpKey(input.getDestinationIp())).build();
    WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
    transaction.delete(LogicalDatastoreType.CONFIGURATION, extPath);
    ListenableFuture<Void> futureCheck = transaction.submit();
    Futures.addCallback(futureCheck, new FutureCallback<Void>() {

        @Override
        public void onSuccess(Void voidInstance) {
            result.set(RpcResultBuilder.<Void>success().build());
        }

        @Override
        public void onFailure(Throwable error) {
            String msg = "Unable to delete DcGatewayIp " + input.getDestinationIp() + " in datastore and tunnel type " + input.getTunnelType();
            LOG.error("Unable to delete DcGatewayIp {} in datastore and tunnel type {}", input.getDestinationIp(), input.getTunnelType());
            result.set(RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.APPLICATION, msg, error).build());
        }
    });
    return result;
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) DcGatewayIp(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp) DcGatewayIpKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIpKey) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)

Example 5 with DcGatewayIp

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp in project genius by opendaylight.

the class ItmUtils method getDcGatewayIpList.

public static List<DcGatewayIp> getDcGatewayIpList(DataBroker broker) {
    InstanceIdentifier<DcGatewayIpList> dcGatewayIpListid = InstanceIdentifier.builder(DcGatewayIpList.class).build();
    Optional<DcGatewayIpList> dcGatewayIpListConfig = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, dcGatewayIpListid, broker);
    if (dcGatewayIpListConfig.isPresent()) {
        DcGatewayIpList containerList = dcGatewayIpListConfig.get();
        if (containerList != null) {
            return containerList.getDcGatewayIp();
        }
    }
    return null;
}
Also used : DcGatewayIpList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.DcGatewayIpList)

Aggregations

DcGatewayIp (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp)6 ArrayList (java.util.ArrayList)4 DPNTEPsInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)4 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)3 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)3 DcGatewayIpKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIpKey)3 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)3 DcGatewayIpList (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.DcGatewayIpList)2 DcGatewayIpBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIpBuilder)2 Objects (com.google.common.base.Objects)1 Optional (com.google.common.base.Optional)1 FutureCallback (com.google.common.util.concurrent.FutureCallback)1 Futures (com.google.common.util.concurrent.Futures)1 MoreExecutors (com.google.common.util.concurrent.MoreExecutors)1 SettableFuture (com.google.common.util.concurrent.SettableFuture)1 BigInteger (java.math.BigInteger)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1