Search in sources :

Example 6 with ActionOutput

use of org.opendaylight.genius.mdsalutil.actions.ActionOutput in project genius by opendaylight.

the class TestOdlInterfaceRpcService method getEgressActionsForInterface.

@Override
public Future<RpcResult<GetEgressActionsForInterfaceOutput>> getEgressActionsForInterface(GetEgressActionsForInterfaceInput input) {
    RpcResultBuilder<GetEgressActionsForInterfaceOutput> rpcResultBuilder;
    List<ActionInfo> listActionInfo = new ArrayList<>();
    List<Action> actionsList = new ArrayList<>();
    listActionInfo.add(new ActionOutput(1, new Uri(URI)));
    for (ActionInfo actionInfo : listActionInfo) {
        actionsList.add(actionInfo.buildAction());
    }
    GetEgressActionsForInterfaceOutputBuilder output = new GetEgressActionsForInterfaceOutputBuilder().setAction(actionsList);
    rpcResultBuilder = RpcResultBuilder.success();
    rpcResultBuilder.withResult(output.build());
    return Futures.immediateFuture(rpcResultBuilder.build());
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) ArrayList(java.util.ArrayList) GetEgressActionsForInterfaceOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceOutput) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) GetEgressActionsForInterfaceOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceOutputBuilder) ActionOutput(org.opendaylight.genius.mdsalutil.actions.ActionOutput) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)

Example 7 with ActionOutput

use of org.opendaylight.genius.mdsalutil.actions.ActionOutput in project genius by opendaylight.

the class AlivenessProtocolHandlerLLDP method getInterfaceActions.

private List<ActionInfo> getInterfaceActions(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface interfaceState, long portNum) throws InterruptedException, ExecutionException {
    Class<? extends InterfaceType> intfType;
    if (interfaceState != null) {
        intfType = interfaceState.getType();
    } else {
        LOG.error("Could not retrieve port type for interface to construct actions");
        return Collections.emptyList();
    }
    List<ActionInfo> actionInfos = new ArrayList<>();
    // Set the LLDP service Id which is 0
    if (Tunnel.class.equals(intfType)) {
        actionInfos.add(new ActionSetFieldTunnelId(BigInteger.ZERO));
    }
    actionInfos.add(new ActionOutput(new Uri(Long.toString(portNum))));
    return actionInfos;
}
Also used : ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) ActionSetFieldTunnelId(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId) ActionOutput(org.opendaylight.genius.mdsalutil.actions.ActionOutput) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)

Example 8 with ActionOutput

use of org.opendaylight.genius.mdsalutil.actions.ActionOutput in project genius by opendaylight.

the class MdSalUtilTest method createGroupEntity.

public GroupEntity createGroupEntity(String nodeid, String inport, int vlanid) {
    List<BucketInfo> listBucketInfo = new ArrayList<>();
    List<ActionInfo> listActionInfo = new ArrayList<>();
    if (vlanid > 0) {
        listActionInfo.add(new ActionPushVlan());
        listActionInfo.add(new ActionSetFieldVlanVid(vlanid));
    }
    listActionInfo.add(new ActionOutput(new Uri(inport), 65535));
    listBucketInfo.add(new BucketInfo(listActionInfo));
    String groupName = "Test Group";
    BigInteger dpnId = new BigInteger(nodeid.split(":")[1]);
    long id = getUniqueValue(nodeid, inport);
    return MDSALUtil.buildGroupEntity(dpnId, id, groupName, GroupTypes.GroupIndirect, listBucketInfo);
}
Also used : ArrayList(java.util.ArrayList) ActionSetFieldVlanVid(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldVlanVid) BigInteger(java.math.BigInteger) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) BucketInfo(org.opendaylight.genius.mdsalutil.BucketInfo) ActionPushVlan(org.opendaylight.genius.mdsalutil.actions.ActionPushVlan) ActionOutput(org.opendaylight.genius.mdsalutil.actions.ActionOutput) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)

Example 9 with ActionOutput

use of org.opendaylight.genius.mdsalutil.actions.ActionOutput in project genius by opendaylight.

the class DirectTunnelUtils method getEgressActionInfosForInterface.

private static List<ActionInfo> getEgressActionInfosForInterface(String tunnelType, String portNo, Long tunnelKey, int actionKeyStart) {
    List<ActionInfo> result = new ArrayList<>();
    switch(tunnelType) {
        case ITMConstants.TUNNEL_TYPE_GRE:
        case ITMConstants.TUNNEL_TYPE_MPLSoGRE:
            // Invoke IFM RPC and pass it on to the caller.
            LOG.warn("Interface Type {} not handled by ITM", tunnelType);
            break;
        case ITMConstants.TUNNEL_TYPE_VXLAN:
            // TODO tunnel_id to encode GRE key, once it is supported
            // Until then, tunnel_id should be "cleaned", otherwise it stores the value coming from a VXLAN tunnel
            result.add(new ActionSetFieldTunnelId(actionKeyStart++, BigInteger.valueOf(tunnelKey != null ? tunnelKey : 0L)));
            result.add(new ActionOutput(actionKeyStart, new Uri(portNo)));
            break;
        default:
            LOG.warn("Interface Type {} not handled yet", tunnelType);
            break;
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) ActionSetFieldTunnelId(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId) ActionOutput(org.opendaylight.genius.mdsalutil.actions.ActionOutput) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)

Aggregations

ActionOutput (org.opendaylight.genius.mdsalutil.actions.ActionOutput)9 ArrayList (java.util.ArrayList)8 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)8 Uri (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)7 ActionPushVlan (org.opendaylight.genius.mdsalutil.actions.ActionPushVlan)4 ActionSetFieldTunnelId (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId)4 ActionSetFieldVlanVid (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldVlanVid)4 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)3 GetEgressActionsForInterfaceOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceOutput)3 BigInteger (java.math.BigInteger)2 ExecutionException (java.util.concurrent.ExecutionException)2 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)2 BucketInfo (org.opendaylight.genius.mdsalutil.BucketInfo)2 ActionGroup (org.opendaylight.genius.mdsalutil.actions.ActionGroup)2 ActionNxResubmit (org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit)2 ActionRegLoad (org.opendaylight.genius.mdsalutil.actions.ActionRegLoad)2 OutputActionCase (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase)2 PushVlanActionCase (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase)2 SetFieldCase (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase)2 GetEgressActionsForInterfaceInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceInputBuilder)2