Search in sources :

Example 81 with Errors

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcerr.message.pcerr.message.Errors in project bgpcep by opendaylight.

the class PcRptMessageCodec method getValidReports.

@Override
protected Reports getValidReports(final List<Object> objects, final List<Message> errors) {
    final Optional<Object> find = Iterables.tryFind(objects, Predicates.instanceOf(BandwidthUsage.class));
    final Object object;
    if (find.isPresent()) {
        object = find.get();
        objects.remove(object);
    } else {
        object = null;
    }
    final Reports validReports = super.getValidReports(objects, errors);
    if (object != null && validReports != null) {
        final Path path = validReports.getPath();
        if (path != null) {
            return new ReportsBuilder(validReports).setPath(new PathBuilder(path).setBandwidth(setBandwidthUsage(path.getBandwidth(), (BandwidthUsage) object)).build()).build();
        }
    }
    return validReports;
}
Also used : Path(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.reports.Path) PathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.reports.PathBuilder) ReportsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.ReportsBuilder) BandwidthUsage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev171025.bandwidth.usage.object.BandwidthUsage) Reports(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.Reports) Object(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object)

Example 82 with Errors

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcerr.message.pcerr.message.Errors in project netvirt by opendaylight.

the class VpnUtil method releaseId.

public static void releaseId(IdManagerService idManager, String poolName, String idKey) {
    ReleaseIdInput idInput = new ReleaseIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
    try {
        Future<RpcResult<Void>> result = idManager.releaseId(idInput);
        RpcResult<Void> rpcResult = result.get();
        if (!rpcResult.isSuccessful()) {
            LOG.error("releaseId: RPC Call to release Id for key {} from pool {} returned with Errors {}", idKey, poolName, rpcResult.getErrors());
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("releaseId: Exception when releasing Id for key {} from pool {}", idKey, poolName, e);
    }
}
Also used : ReleaseIdInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ReleaseIdInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput) ExecutionException(java.util.concurrent.ExecutionException)

Example 83 with Errors

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcerr.message.pcerr.message.Errors in project netvirt by opendaylight.

the class VpnUtil method getUniqueId.

public static int getUniqueId(IdManagerService idManager, String poolName, String idKey) {
    AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
    try {
        Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput);
        RpcResult<AllocateIdOutput> rpcResult = result.get();
        if (rpcResult.isSuccessful()) {
            return rpcResult.getResult().getIdValue().intValue();
        } else {
            LOG.error("getUniqueId: RPC Call to Get Unique Id from pool {} with key {} returned with Errors {}", poolName, idKey, rpcResult.getErrors());
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("getUniqueId: Exception when getting Unique Id from pool {} for key {}", poolName, idKey, e);
    }
    return 0;
}
Also used : AllocateIdInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder) AllocateIdInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ExecutionException(java.util.concurrent.ExecutionException) AllocateIdOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput)

Example 84 with Errors

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcerr.message.pcerr.message.Errors in project netvirt by opendaylight.

the class EvpnUtils method getEndpointIpAddressForDPN.

public String getEndpointIpAddressForDPN(BigInteger dpnId) {
    Future<RpcResult<GetDpnEndpointIpsOutput>> result = itmRpcService.getDpnEndpointIps(new GetDpnEndpointIpsInputBuilder().setSourceDpid(dpnId).build());
    RpcResult<GetDpnEndpointIpsOutput> rpcResult = null;
    try {
        rpcResult = result.get();
    } catch (InterruptedException e) {
        LOG.error("getnextHopIpFromRpcOutput : InterruptedException for dpnid {}", dpnId, e);
        return null;
    } catch (ExecutionException e) {
        LOG.error("getnextHopIpFromRpcOutput : ExecutionException for dpnid {}", dpnId, e);
        return null;
    }
    if (!rpcResult.isSuccessful()) {
        LOG.warn("RPC Call to getDpnEndpointIps returned with Errors {}", rpcResult.getErrors());
        return null;
    }
    List<IpAddress> nexthopIpList = rpcResult.getResult().getNexthopipList();
    return nexthopIpList.get(0).getIpv4Address().getValue();
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) GetDpnEndpointIpsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnEndpointIpsInputBuilder) GetDpnEndpointIpsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetDpnEndpointIpsOutput) ExecutionException(java.util.concurrent.ExecutionException)

Example 85 with Errors

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcerr.message.pcerr.message.Errors in project netvirt by opendaylight.

the class AlivenessMonitorUtils method createMonitorProfile.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
public static Optional<Long> createMonitorProfile(AlivenessMonitorService alivenessMonitor, MonitorProfileCreateInput monitorProfileCreateInput) {
    try {
        Future<RpcResult<MonitorProfileCreateOutput>> result = alivenessMonitor.monitorProfileCreate(monitorProfileCreateInput);
        RpcResult<MonitorProfileCreateOutput> rpcResult = result.get();
        if (rpcResult.isSuccessful()) {
            return Optional.of(rpcResult.getResult().getProfileId());
        } else {
            LOG.warn("RPC Call to Get Profile Id Id returned with Errors {}.. Trying to fetch existing profile ID", rpcResult.getErrors());
            try {
                Profile createProfile = monitorProfileCreateInput.getProfile();
                Future<RpcResult<MonitorProfileGetOutput>> existingProfile = alivenessMonitor.monitorProfileGet(buildMonitorGetProfile(createProfile.getMonitorInterval(), createProfile.getMonitorWindow(), createProfile.getFailureThreshold(), createProfile.getProtocolType()));
                RpcResult<MonitorProfileGetOutput> rpcGetResult = existingProfile.get();
                if (rpcGetResult.isSuccessful()) {
                    return Optional.of(rpcGetResult.getResult().getProfileId());
                } else {
                    LOG.warn("RPC Call to Get Existing Profile Id returned with Errors {}", rpcGetResult.getErrors());
                }
            } catch (Exception e) {
                LOG.warn("Exception when getting existing profile", e);
            }
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.warn("Exception when allocating profile Id", e);
    }
    return Optional.absent();
}
Also used : MonitorProfileCreateOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileCreateOutput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) MonitorProfileGetOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileGetOutput) ExecutionException(java.util.concurrent.ExecutionException) Profile(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.create.input.Profile) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)61 ExecutionException (java.util.concurrent.ExecutionException)59 ArrayList (java.util.ArrayList)40 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)21 Test (org.junit.Test)16 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object)16 AllocateIdInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput)12 AllocateIdInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder)12 AllocateIdOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput)12 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object)11 PCEPErrors (org.opendaylight.protocol.pcep.spi.PCEPErrors)10 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)10 ReleaseIdInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput)10 ReleaseIdInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInputBuilder)10 GetEgressActionsForInterfaceInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceInputBuilder)10 GetEgressActionsForInterfaceOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceOutput)10 Errors (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcerr.message.pcerr.message.Errors)10 ByteBuf (io.netty.buffer.ByteBuf)9 ErrorsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcerr.message.pcerr.message.ErrorsBuilder)8 Rp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.rp.object.Rp)7