Search in sources :

Example 6 with Errors

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

the class ExternalRoutersListener method getTunnelInterfaceName.

protected String getTunnelInterfaceName(BigInteger srcDpId, BigInteger dstDpId) {
    Class<? extends TunnelTypeBase> tunType = TunnelTypeVxlan.class;
    RpcResult<GetTunnelInterfaceNameOutput> rpcResult;
    try {
        Future<RpcResult<GetTunnelInterfaceNameOutput>> result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
        rpcResult = result.get();
        if (!rpcResult.isSuccessful()) {
            tunType = TunnelTypeGre.class;
            result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
            rpcResult = result.get();
            if (!rpcResult.isSuccessful()) {
                LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
            } else {
                return rpcResult.getResult().getInterfaceName();
            }
            LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
        } else {
            return rpcResult.getResult().getInterfaceName();
        }
    } catch (InterruptedException | ExecutionException | NullPointerException e) {
        LOG.error("getTunnelInterfaceName : Exception when getting tunnel interface Id for tunnel " + "between {} and {}", srcDpId, dstDpId, e);
    }
    return null;
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetTunnelInterfaceNameOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameOutput) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) ExecutionException(java.util.concurrent.ExecutionException) GetTunnelInterfaceNameInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder)

Example 7 with Errors

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

the class InterfaceStateEventListener method getFixedIpsForPort.

private List<String> getFixedIpsForPort(String interfname) {
    LOG.debug("getFixedIpsForPort : getFixedIpsForPort method is called for interface {}", interfname);
    try {
        Future<RpcResult<GetFixedIPsForNeutronPortOutput>> result = neutronVpnService.getFixedIPsForNeutronPort(new GetFixedIPsForNeutronPortInputBuilder().setPortId(new Uuid(interfname)).build());
        RpcResult<GetFixedIPsForNeutronPortOutput> rpcResult = result.get();
        if (!rpcResult.isSuccessful()) {
            LOG.error("getFixedIpsForPort : RPC Call to GetFixedIPsForNeutronPortOutput returned with Errors {}", rpcResult.getErrors());
        } else {
            return rpcResult.getResult().getFixedIPs();
        }
    } catch (InterruptedException | ExecutionException | NullPointerException ex) {
        LOG.error("getFixedIpsForPort : Exception while receiving fixedIps for port {}", interfname, ex);
    }
    return null;
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetFixedIPsForNeutronPortOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.GetFixedIPsForNeutronPortOutput) ExecutionException(java.util.concurrent.ExecutionException) GetFixedIPsForNeutronPortInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.GetFixedIPsForNeutronPortInputBuilder)

Example 8 with Errors

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

the class NexthopManager method getEgressActionsForInterface.

protected List<ActionInfo> getEgressActionsForInterface(final String ifName, int actionKey) {
    List<ActionInfo> listActionInfo = new ArrayList<>();
    try {
        Future<RpcResult<GetEgressActionsForInterfaceOutput>> result = interfaceManager.getEgressActionsForInterface(new GetEgressActionsForInterfaceInputBuilder().setIntfName(ifName).build());
        RpcResult<GetEgressActionsForInterfaceOutput> rpcResult = result.get();
        if (!rpcResult.isSuccessful()) {
            LOG.error("RPC Call to Get egress actions for interface {} returned with Errors {}", ifName, rpcResult.getErrors());
        } else {
            List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions = rpcResult.getResult().getAction();
            for (Action action : actions) {
                actionKey = action.getKey().getOrder() + actionKey;
                org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionClass = action.getAction();
                if (actionClass instanceof OutputActionCase) {
                    listActionInfo.add(new ActionOutput(actionKey, ((OutputActionCase) actionClass).getOutputAction().getOutputNodeConnector()));
                } else if (actionClass instanceof PushVlanActionCase) {
                    listActionInfo.add(new ActionPushVlan(actionKey));
                } else if (actionClass instanceof SetFieldCase) {
                    if (((SetFieldCase) actionClass).getSetField().getVlanMatch() != null) {
                        int vlanVid = ((SetFieldCase) actionClass).getSetField().getVlanMatch().getVlanId().getVlanId().getValue();
                        listActionInfo.add(new ActionSetFieldVlanVid(actionKey, vlanVid));
                    }
                } else if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
                    Short tableId = ((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable();
                    listActionInfo.add(new ActionNxResubmit(actionKey, tableId));
                } else if (actionClass instanceof NxActionRegLoadNodesNodeTableFlowApplyActionsCase) {
                    NxRegLoad nxRegLoad = ((NxActionRegLoadNodesNodeTableFlowApplyActionsCase) actionClass).getNxRegLoad();
                    listActionInfo.add(new ActionRegLoad(actionKey, NxmNxReg6.class, nxRegLoad.getDst().getStart(), nxRegLoad.getDst().getEnd(), nxRegLoad.getValue().longValue()));
                }
            }
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.warn("Exception when egress actions for interface {}", ifName, e);
    }
    return listActionInfo;
}
Also used : NxActionResubmitRpcAddGroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionResubmitRpcAddGroupCase) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) GetEgressActionsForInterfaceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceInputBuilder) SetFieldCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase) NxActionRegLoadNodesNodeTableFlowApplyActionsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadNodesNodeTableFlowApplyActionsCase) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) PushVlanActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase) ActionSetFieldVlanVid(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldVlanVid) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) GetEgressActionsForInterfaceOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceOutput) WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) ExecutionException(java.util.concurrent.ExecutionException) OutputActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase) ActionOutput(org.opendaylight.genius.mdsalutil.actions.ActionOutput) NxRegLoad(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.NxRegLoad) NxmNxReg6(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg6) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ActionRegLoad(org.opendaylight.genius.mdsalutil.actions.ActionRegLoad) ActionPushVlan(org.opendaylight.genius.mdsalutil.actions.ActionPushVlan)

Example 9 with Errors

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

the class ElanUtils method retrieveNewElanTag.

/**
 * Uses the IdManager to retrieve a brand new ElanTag.
 *
 * @param idManager
 *            the id manager
 * @param idKey
 *            the id key
 * @return the integer
 */
public static Long retrieveNewElanTag(IdManagerService idManager, String idKey) {
    AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(ElanConstants.ELAN_ID_POOL_NAME).setIdKey(idKey).build();
    try {
        Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput);
        RpcResult<AllocateIdOutput> rpcResult = result.get();
        if (rpcResult.isSuccessful()) {
            return rpcResult.getResult().getIdValue();
        } else {
            LOG.warn("RPC Call to Allocate Id returned with Errors {}", rpcResult.getErrors());
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.warn("Exception when Allocating Id", e);
    }
    return 0L;
}
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 10 with Errors

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

the class DhcpPktHandler method getEgressAction.

private List<Action> getEgressAction(String interfaceName, BigInteger tunnelId) {
    List<Action> actions = null;
    try {
        GetEgressActionsForInterfaceInputBuilder egressAction = new GetEgressActionsForInterfaceInputBuilder().setIntfName(interfaceName);
        if (tunnelId != null) {
            egressAction.setTunnelKey(tunnelId.longValue());
        }
        Future<RpcResult<GetEgressActionsForInterfaceOutput>> result = interfaceManagerRpc.getEgressActionsForInterface(egressAction.build());
        RpcResult<GetEgressActionsForInterfaceOutput> rpcResult = result.get();
        if (!rpcResult.isSuccessful()) {
            LOG.warn("RPC Call to Get egress actions for interface {} returned with Errors {}", interfaceName, rpcResult.getErrors());
        } else {
            actions = rpcResult.getResult().getAction();
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.warn("Exception when egress actions for interface {}", interfaceName, e);
    }
    return actions;
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) GetEgressActionsForInterfaceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetEgressActionsForInterfaceOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceOutput) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)45 ExecutionException (java.util.concurrent.ExecutionException)38 ArrayList (java.util.ArrayList)21 Test (org.junit.Test)15 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object)11 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)10 Errors (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.Errors)10 ByteBuf (io.netty.buffer.ByteBuf)9 AllocateIdInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput)9 AllocateIdInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder)9 AllocateIdOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput)9 ReleaseIdInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput)9 ReleaseIdInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInputBuilder)9 ErrorsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.ErrorsBuilder)9 PCEPErrors (org.opendaylight.protocol.pcep.spi.PCEPErrors)8 Rp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.Rp)7 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)6 ErrorObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObject)6 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)5 Preconditions (com.google.common.base.Preconditions)4